Skip to content

Rain SDK

TypeScript SDK for integrating Rain Cards corporate crypto cards into your application. Rain enables companies to spend directly from their crypto treasury using Visa cards, without off-ramping.

Installation

sh
yarn add rain-sdk
sh
npm install rain-sdk

Quick Start

typescript
import { createClient } from "rain-sdk";

const rain = createClient({
  baseURL: "https://api.raincards.xyz/v1/issuing",
  apiKey: "your-api-key"
});

// List users
const { data: users } = await rain.users.getUsers();

// List cards
const { data: cards } = await rain.cards.getCards({ type: "virtual" });

// Check a user's balance (amounts in cents)
const { data: balance } = await rain.balances.getUserBalances("user-id");
console.log(`Spending power: $${balance.spendingPower / 100}`);

Configuration

typescript
import type { RainConfig } from "rain-sdk";

const config: RainConfig = {
  baseURL: string;  // Rain API base URL
  apiKey: string;   // Your API key (sent as Api-Key header)
};
FieldDescription
baseURLRain API base URL. Production: https://api.raincards.xyz/v1/issuing
apiKeyYour Rain API key. Passed via Api-Key header on every request.

The SDK also accepts an optional axiosInstance if you need custom interceptors or retry logic.

Service Modules

The client exposes 13 namespaced service modules:

ModuleDescriptionDocs
usersCreate, update, delete users; query balances; charge custom feesUsers
cardsCreate virtual/physical cards; freeze, unfreeze, cancel; manage PINs and secretsCards
applicationsIndividual (KYC) and corporate (KYB) application flowsApplications
companiesCompany CRUD, custom charges--
contractsSmart contract wallet management (multi-chain)Smart Contracts
balancesCredit balance queries at tenant, company, and user levelPayment System
transactionsList and retrieve transaction details--
paymentsInitiate on-chain payments for companies and usersPayment System
webhooksWebhook event history, signature verification, key rotationWebhooks
signaturesPayment and withdrawal signature management--
shippingBulk shipping groups, address validation--
keysAPI key creation and deletion--
disputesTransaction dispute lifecycle management--

All methods are available both via namespace (rain.cards.getCards()) and flat access (rain.getCards()).

Amounts in Cents

All monetary amounts in the Rain API are expressed in cents (smallest currency unit). 50000 = $500.00.

TypeScript Support

The SDK ships with full TypeScript definitions. See the Types Reference for all exported types.

typescript
import type { RainUser, RainCard, CreditBalance } from "rain-sdk";

Environment Variables

env
RAIN_API_URL=https://api.raincards.xyz/v1/issuing
RAIN_API_KEY=your-api-key
Rain SDK has loaded