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.
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
Retry with proof
200 OK
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 (
eip155:8453). It is not available on other chains
or tokens. Settlement is performed by Coinbase’s hosted facilitator; Sprintcheckout never holds funds.