Payment System
Rain operates as a collateralized credit card system backed by stablecoins. Your crypto collateral secures your credit line, eliminating default risk while enabling fiat spending.
How It Works
- Deposit collateral -- Send supported stablecoins to your on-chain contract
- Spend with cards -- Rain fronts fiat payments to merchants when you swipe
- Collateral stays on-chain -- Your crypto remains untouched during the billing period
- Monthly statement -- At month end, you receive a statement with total balance owed
- 8-day grace period -- Pay off the balance manually within 8 days
- Auto-liquidation -- If unpaid, Rain liquidates the owed amount from your collateral
- Remainder carries forward -- Remaining collateral stays available for next month
Collateral Rates
Each supported stablecoin has a rate determining the collateral-to-credit ratio:
| Asset | Rate | Meaning |
|---|---|---|
| USDC | 1.0 | $1 USDC = $1 credit limit |
| PYUSD | 1.0 | $1 PYUSD = $1 credit limit |
Credit Limit = Collateral Balance x RateFor stablecoins, the rate is 1:1. No defaults are possible because the credit limit always equals the collateral value.
CreditBalance
Query balances at tenant, company, or user level. All amounts are in cents.
// Tenant-level balance
const { data: tenantBalance } = await rain.balances.getTenantBalances();
// Company-level balance
const { data: companyBalance } = await rain.balances.getCompanyBalances("company-id");
// User-level balance
const { data: userBalance } = await rain.balances.getUserBalances("user-id");CreditBalance Interface
interface CreditBalance {
creditLimit: number; // Maximum credit available (cents)
pendingCharges: number; // Authorized but not posted transactions (cents)
postedCharges: number; // Completed and settled transactions (cents)
balanceDue: number; // Total amount currently owed (cents)
spendingPower: number; // Available credit to spend (cents)
}| Field | Description | Example |
|---|---|---|
creditLimit | Maximum credit based on collateral | 100000 ($1,000) |
pendingCharges | Authorized but not yet settled | 5000 ($50) |
postedCharges | Completed, settled transactions | 3000 ($30) |
balanceDue | Total currently owed | 8000 ($80) |
spendingPower | Available credit remaining | 92000 ($920) |
spendingPower = creditLimit - balanceDueInitiate Payments
Initiate on-chain payments for companies or individual users:
// Company payment
const { data: payment } = await rain.payments.initiateCompanyPayment("company-id", {
amount: 50000, // $500.00 in cents
walletAddress: "0x...",
chainId: 1 // Ethereum mainnet
});
// User payment
const { data: payment } = await rain.payments.initiateUserPayment("user-id", {
amount: 25000,
walletAddress: "0x...",
chainId: 137 // Polygon
});Fees and Custom Charges
Platform Fees
Rain charges platform fees (monthly/annual) directly. These appear as webhook events with transactionType: "fee".
Custom Charges
Apply custom fees to users via the charge API. Charges are per-user, not per-card.
await rain.users.chargeUser("user-id", {
amount: 2550, // $25.50 in cents
description: "Monthly service fee"
});Spending Power = Credit Limit - Pending - Posted - Fees + PaymentsFees reduce the credit balance (spending power), not the collateral directly. Collateral is only liquidated during the monthly auto-liquidation cycle.
WARNING
Custom charges are post-authorization and may cause a user's balance to go negative. The Rain charge API does not accept an idempotency key -- implement your own deduplication logic.
Supported Stablecoins
- USDC (Circle)
- PYUSD (PayPal USD)
- Glow Dollar
Supported Chains
- Ethereum Mainnet
- Polygon
- Base, Optimism, Arbitrum (coming soon)
Infrastructure Flow
Under the hood, Rain's payment infrastructure works as follows:
- Borrowing -- Rain borrows from on-chain lenders (Credit Coop, Huma Finance) against receivables
- Off-ramping -- Stablecoins are off-ramped through issuers (e.g., Circle for USDC)
- Settlement -- Rain settles with Visa and merchants in fiat
- Reconciliation -- At month end, balances are reconciled against collateral