How it works
Configure your Base wallet
In Settings → Wallet address, set the Base wallet that should receive USDC. This existing
address is what the
402 challenge quotes as payTo. No x402-specific configuration is needed.Create a payment session (server-side)
Your backend creates a session with your secret
X-SC-ApiKey and receives a public sessionId.The agent pays over x402
The agent requests the x402 endpoint with the public
sessionId, receives a 402 Payment Required quoting your wallet and the USDC amount, pays on Base, and retries with proof.1. Merchant — create a payment session
This runs on your server, with your secretX-SC-ApiKey. The response sessionId is the public
identifier the agent will pay.
cURL
Response
2. Agent — pay over x402
The agent uses only the publicsessionId — no secret. A first request returns the challenge:
cURL
402 Payment Required
maxAmountRequired is in USDC base units (6 decimals — 10000 = 0.01 USDC). payTo is the
merchant’s Base wallet from Settings. network is the x402 network name base (Base mainnet).
extra carries USDC’s EIP-712 domain (name/version) that the agent’s wallet signs the gasless
transfer against — x402-fetch reads it automatically, so you rarely handle it by hand.
The simplest way to pay is the official x402-fetch wrapper,
which handles the challenge, the on-chain USDC payment on Base, and the retry with the X-PAYMENT
proof header automatically:
x402-fetch
x402-fetch caps spend at 0.1 USDC by default. To pay more, raise the limit:
wrapFetchWithPayment(fetch, wallet, maxValue) where maxValue is in USDC base units
(e.g. BigInt(1_000_000) for 1 USDC). Larger amounts also need the buyer wallet funded with
enough USDC on Base.Buyer-chosen (variable) amounts. If the session was created with an editable amount, the agent
declares what it will pay with an
?amount= query parameter (in the session’s currency) on both
the initial request and the X-PAYMENT retry — e.g. …/x402/session/{sessionId}?amount=2.50.
Without it, the 402 body asks for ?amount= and echoes the minAmount floor.Retry with proof
200 OK
receipt links the settled transaction on BaseScan; the same order appears in your dashboard
transaction list. The X-PAYMENT-RESPONSE header is the facilitator’s base64 settlement response.
Response codes
| Status | Meaning |
|---|---|
200 OK | Paid — the resource is returned. A request against an already-settled session also returns 200 idempotently (the session is never charged twice). |
404 Not Found | Unknown or expired sessionId. |
422 Unprocessable Entity | The merchant has no Base wallet configured in Settings, so no payTo can be quoted. |
402 Payment Required | No payment yet, or the submitted proof is missing / invalid / insufficient — re-pay against the returned challenge. |
x402 settlement uses mainnet USDC on Base (network
base, chain id 8453). It is not available
on other chains or tokens. Settlement is performed by Coinbase’s hosted CDP facilitator; Sprintcheckout
never holds funds. The buyer pays no gas — the transfer is a gasless EIP-3009 authorization the
facilitator submits on-chain.