Dev.to WebDev 🛠 Dev 👁 0 📖 4 min read

How to accept CAI payments on your site: card, crypto, and wallet-to-wallet settlement

How to accept CAI payments on your site: card, crypto, and wallet-to-wallet settlement Your SaaS charges $10/month. A developer asks if they can pay with USDC from their agent wallet instead of a credit card. CAI gives

How to accept CAI payments on your site: card, crypto, and wallet-to-wallet settlement

Your SaaS charges $10/month. A developer asks if they can pay with USDC from their agent wallet instead of a credit card. CAI gives you three paths to receive payments, each with one API call. Here is how they work and when to use each one.

Path one: card payments via MoonPay

For customers who want to pay with a credit card, CAI provides POST /create-onramp-url. You call this with your CAI API key, and it returns a MoonPay URL. Your customer opens that URL, enters their card details, and the USDC lands in your custodial EVM address.

curl -sS https://api.cai.com/functions/v1/create-onramp-url \
  -H "Authorization: Bearer *** \
  -H "Content-Type: application/json" \
  -d '{"amount_usd": 10}'

The response includes a url field. You share this with your customer, either by redirecting them or embedding it as a link. MoonPay handles the card processing, KYC, and conversion. The settlement arrives as USDC on the EVM chain you have configured.

A few things to know about this path. MoonPay availability depends on the customer's region. If MoonPay returns 503 or a geo-block, the honest answer is that card is unavailable for that customer, and you fall back to the crypto path below. Third-party KYC and region limits apply, which CAI notes as a Partial live capability with third-party dependencies.

Path two: crypto deposits via deposit link

For customers who hold USDC or USDT and want to pay directly from their wallet, CAI provides POST /create-deposit-link. This returns a hosted action URL on https://cai.com/act/<token> where the customer sees their deposit address and can optionally use an embedded card checkout.

curl -sS https://api.cai.com/functions/v1/create-hosted-action \
  -H "Authorization: Bearer *** \
  -H "Content-Type: application/json" \
  -d '{"action_type": "deposit", "constraints": {"payment_method": "crypto", "crypto_asset": "USDC_ERC20"}}'

The response contains a url field. Your customer opens this URL, copies the deposit address or uses the embedded interface, and sends USDC from their wallet. Once the transaction confirms on chain, your custodial wallet shows the balance.

When your customer holds a CAI wallet and you know their @cai.com email, the simplest path is direct wallet-to-wallet. They call resolve-transfer-recipient to confirm your address, then wallet-custodial-transfer to send. On your side, you verify with POST /transfer-status using the transaction hash they share, or by polling GET /wallet-activity-list for incoming activity.

CAI supports custodial transfers on ETH, BSC, Polygon, Arbitrum, Base, and Tron, with USDT, USDC, DAI, and native tokens where each chain supports them. You specify which chain and token you want to receive, and the user's wallet settles on that chain from their custodial balance.

Path three: recurring billing via payment mandates

For subscriptions and recurring charges, the customer sets up a payment mandate. This is an AP2-like delegated spending permission that allows their agent to send payments within defined limits without per-transaction approval.

The mandate specifies the merchant domain, the maximum per-payment amount, a daily cap, and an expiration. The default daily cap is $200/day. The customer can revoke the mandate at any time from the CAI dashboard.

When the mandate is active, the customer's agent can call x402_payment_execute to settle each billing cycle without asking the customer to confirm every time. The first payment to a new recipient still requires explicit confirmation. After the first transfer, subsequent payments within the mandate limits skip the per-transaction step.

The mandate system is noted as GAP_PAYMENT_MANDATE_V1 in CAI's capability matrix, meaning it is callable and live but is a CAI-native implementation rather than a full W3C/AP2 credential. For card-based recurring billing, use the MoonPay on-ramp URL at each billing cycle.

What CAI replaces in your payment stack

CAI is not a full payment processor. It replaces specific pieces of a traditional payment integration:

  • No merchant account application. You do not need underwriting, a processing agreement, or PCI compliance validation to receive payments. You generate an API key at cai.com/app and start.

  • No redirect loop to Stripe or PayPal. The customer completes the payment on one CAI hosted action page or directly from their wallet. No iframe, no 3D Secure redirect, no callback URL to configure.

  • No chargeback risk. Stablecoin transfers on chain are final. Once the transaction confirms, the funds are yours. There is no dispute window, no reversal, no holds.

  • No webhook infrastructure required. CAI provides polling endpoints for status. Your application checks transfer-status or payment-intent-status and proceeds when the settlement confirms.

CAI does not manage cart state, inventory, tax calculation, or order fulfillment. Your application handles its own order lifecycle. CAI provides the payment confirmation; you decide what to deliver.

The chain and token matrix

CAI supports custodial transfers on these chains:

Chain Native USDT USDC DAI
ETH Yes Yes Yes Yes
BSC Yes Yes Yes Yes
Polygon Yes Yes Yes Yes
Arbitrum Yes Yes Yes No
Base Yes Yes Yes No
Tron Yes Yes (TRC20) Yes (TRC20) No

Cross-chain payments between these chains use CAI's bridge endpoint POST /bridge-quote followed by POST /bridge-execute via LiFi.

Getting started

To accept CAI payments on your site:

  1. Sign up at https://cai.com/app and create an API key with at least the pay scope.
  2. For card payments: call POST /create-onramp-url with your desired amount, share or redirect your customer to the returned URL.
  3. For crypto payments: call POST /create-hosted-action with action_type: "deposit", guide your customer to the returned URL.
  4. For recurring billing: ask the customer to create a payment mandate from their CAI dashboard, then settle each billing cycle via x402.
  5. Poll POST /transfer-status or GET /payment-intent-status to confirm settlement before delivering your product.

No merchant account, no PCI scope, no chargeback risk, no redirect chain. One API call to start receiving USDC in your custodial wallet.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.