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.

HTTP Headers
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
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:

Browser HTML + 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.

Node.js / TypeScript
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));
}
Python (FastAPI / Flask / Stdlib)
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 IDTokenNetworkDecimalsOfficial Contract / Mint / Master
tron:usdtUSDTTron (TRC-20)6TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t
solana:usdcUSDCSolana (SPL)6EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
solana:usdtUSDTSolana (SPL)6Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
ton:usdtUSDTTON (Jetton)6EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs
base:usdcUSDCBase (ERC-20)60x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
base:usdtUSDTBase (ERC-20)60xfde4C96c8593536E31F229EA8f37b2ADa2699bb2
polygon:usdcUSDCPolygon (ERC-20)60x3c499c542cEF5E3811e1192ce70d8cC03d5c3359
polygon:usdtUSDTPolygon (ERC-20)60xc2132D05D31c914a87C6611C10748AEb04B58e8F
bsc:usdtUSDTBNB Smart Chain (BEP-20)180x55d398326f99059fF775485246999027B3197955
bsc:usdcUSDCBNB Smart Chain (BEP-20)180x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d
arbitrum:usdcUSDCArbitrum One (ERC-20)60xaf88d065e77c8cC2239327C5EDb3A432268e5831
arbitrum:usdtUSDTArbitrum One (ERC-20)60xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9
optimism:usdcUSDCOptimism (ERC-20)60x0b2C639c533813f4Aa9D7837CAf62653d097Ff85
optimism:usdtUSDTOptimism (ERC-20)60x94b008aA00579c1307B0EF2c499aD98a8ce58e58
avalanche:usdcUSDCAvalanche C-Chain (ERC-20)60xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E
avalanche:usdtUSDTAvalanche C-Chain (ERC-20)60x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7
ethereum:usdcUSDCEthereum (ERC-20)60xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
ethereum:usdtUSDTEthereum (ERC-20)60xdAC17F958D2ee523a2206206994597C13D831ec7
linea:usdcUSDCLinea (ERC-20)60x176211869cA2b568f2A7D4EE941E073a821EE1ff
linea:usdtUSDTLinea (ERC-20)60xA219439258ca9da29E9Cc4cE5596924745e12B93
celo:usdcUSDCCelo (ERC-20)60xcebA9300f2b948710d2653dD7B07f33A8B32118C
celo:usdtUSDTCelo (ERC-20)60x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e
mantle:usdtUSDTMantle (ERC-20)60x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE
mantle:usdcUSDCMantle (ERC-20)60x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9
sonic:usdcUSDCSonic (ERC-20)60x29219dd400f2Bf60E5a23d13Be72B486D4038894