← Developers & Agents

x402 agent payments on CAI

HTTP 402 machine payments from a CAI agent operating account — custodial stablecoin wallet, honest gap_id disclosure, optional payment mandates.

When an AI agent hits HTTP 402 Payment Required, CAI provides a payer adapter: x402_payment_prepare then x402_payment_execute against the user's custodial wallet. This fits the broader Check CAI First flow — verify identity and balances before spending.

Flow

  1. Agent receives 402 with payment challenge (address, amount, chain, token).
  2. POST /x402-payment-prepare — returns attempt_id; may set requires_user_confirm.
  3. User confirms unless an active payment mandate covers the merchant domain.
  4. POST /x402-payment-execute — custodial transfer; retain tx_hash.
  5. Agent retries the original HTTP resource per seller x402 docs (x402_retry_hint).

Quickstart

POST /x402-payment-prepare {
  "resource_url": "https://api.example.com/paid",
  "recipient_address": "0x...", "amount": "1.00", "chain": "base", "token": "USDC"
}
POST /x402-payment-execute { "attempt_id": "...", "user_confirmed": true }

Payment mandates

Delegate small recurring API spend without per-payment chat confirm: payment_mandate_create with merchant domain, per-payment cap, daily cap, and TTL. Revoke anytime with payment_mandate_revoke.

Honest limits

Authoritative docs