CleverPay API v1 · 0.75% Flat Fee
Integrate stablecoin checkout in 15 minutes.
Paddle-grade checkout sessions, drop-in overlay modal, HMAC-SHA256 webhooks, and verified non-custodial settlement across 14 mainnet networks.
1. Authentication & Sandbox Mode
Generate API keys from Dashboard → Developers. Keys prefixed with cp_test_ create sandbox sessions (with a 1-click simulated confirmation button to test webhooks safely). Keys prefixed with cp_live_ enforce strict live mainnet verification.
Authorization: Bearer cp_live_your_secret_key Idempotency-Key: order_12345
2. Create a Checkout Session
POST /api/v1/checkout-sessions — Pass an existing product_id or an ad-hoc title + amount_cents (integer USD cents). Every session automatically calculates your 99.25% net and 0.75% autonomous split (fee_bps: 75).
curl -X POST http://localhost:3100/api/v1/checkout-sessions \
-H "Authorization: Bearer cp_test_..." \
-H "Idempotency-Key: invoice-9921" \
-H "Content-Type: application/json" \
-d '{
"title": "100 Coin of Luck Pack",
"amount_cents": 10000,
"preferred_rail_id": "tron:usdt",
"customer_email": "player@example.com",
"customer_reference": "char:Arthas",
"success_url": "https://yourapp.com/account?paid=1",
"metadata": { "pack": "100_col" }
}'3. Open the Paddle-Style Overlay (or Redirect)
Redirect buyers to session.checkout_url or embed the modal directly over your app with /cleverpay.js:
<script src="http://localhost:3100/cleverpay.js"></script>
<script>
CleverPay.Checkout.open({
sessionId: "cs_live_...",
onPaid: (event) => {
console.log("Verified on-chain:", event.rail_id, event.tx_hash);
},
onClose: () => console.log("Checkout dismissed")
});
</script>4. Verify Signed Webhooks (HMAC-SHA256)
Events dispatched: checkout.created, checkout.paid, checkout.underpaid, checkout.expired, and checkout.refunded. Always verify CleverPay-Signature against the raw request body before fulfilling an order.
import crypto from "node:crypto";
export function verifyCleverPaySignature(rawBody: string, header: string, secret: string) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
const expected = crypto
.createHmac("sha256", secret)
.update(`${parts.t}.${rawBody}`)
.digest("hex");
return crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected));
}import hmac, hashlib
def verify_cleverpay_signature(raw_body: bytes, header: str, secret: str) -> bool:
parts = dict(item.split("=", 1) for item in header.split(","))
signed = f"{parts['t']}.".encode() + raw_body
expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
return hmac.compare_digest(parts.get("v1", ""), expected)5. All 25 Verified Mainnet Stablecoin Contracts (14 Networks)
CleverPay rejects spoofed ERC-20/TRC-20/SPL/Jetton tokens by verifying every on-chain transfer strictly against this canonical registry:
| Rail ID | Token | Network | Decimals | Official Contract / Mint / Master |
|---|---|---|---|---|
| tron:usdt | USDT | Tron (TRC-20) | 6 | TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t |
| solana:usdc | USDC | Solana (SPL) | 6 | EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v |
| solana:usdt | USDT | Solana (SPL) | 6 | Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB |
| ton:usdt | USDT | TON (Jetton) | 6 | EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs |
| base:usdc | USDC | Base (ERC-20) | 6 | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
| base:usdt | USDT | Base (ERC-20) | 6 | 0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2 |
| polygon:usdc | USDC | Polygon (ERC-20) | 6 | 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 |
| polygon:usdt | USDT | Polygon (ERC-20) | 6 | 0xc2132D05D31c914a87C6611C10748AEb04B58e8F |
| bsc:usdt | USDT | BNB Smart Chain (BEP-20) | 18 | 0x55d398326f99059fF775485246999027B3197955 |
| bsc:usdc | USDC | BNB Smart Chain (BEP-20) | 18 | 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d |
| arbitrum:usdc | USDC | Arbitrum One (ERC-20) | 6 | 0xaf88d065e77c8cC2239327C5EDb3A432268e5831 |
| arbitrum:usdt | USDT | Arbitrum One (ERC-20) | 6 | 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9 |
| optimism:usdc | USDC | Optimism (ERC-20) | 6 | 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85 |
| optimism:usdt | USDT | Optimism (ERC-20) | 6 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 |
| avalanche:usdc | USDC | Avalanche C-Chain (ERC-20) | 6 | 0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E |
| avalanche:usdt | USDT | Avalanche C-Chain (ERC-20) | 6 | 0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7 |
| ethereum:usdc | USDC | Ethereum (ERC-20) | 6 | 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 |
| ethereum:usdt | USDT | Ethereum (ERC-20) | 6 | 0xdAC17F958D2ee523a2206206994597C13D831ec7 |
| linea:usdc | USDC | Linea (ERC-20) | 6 | 0x176211869cA2b568f2A7D4EE941E073a821EE1ff |
| linea:usdt | USDT | Linea (ERC-20) | 6 | 0xA219439258ca9da29E9Cc4cE5596924745e12B93 |
| celo:usdc | USDC | Celo (ERC-20) | 6 | 0xcebA9300f2b948710d2653dD7B07f33A8B32118C |
| celo:usdt | USDT | Celo (ERC-20) | 6 | 0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e |
| mantle:usdt | USDT | Mantle (ERC-20) | 6 | 0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE |
| mantle:usdc | USDC | Mantle (ERC-20) | 6 | 0x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9 |
| sonic:usdc | USDC | Sonic (ERC-20) | 6 | 0x29219dd400f2Bf60E5a23d13Be72B486D4038894 |