What is x402?
Where does x402 come from?
HTTP 402 has existed in the HTTP specification since 1997 (RFC 2068) but was reserved "for future use" — for almost three decades it had no canonical wire format. Coinbase published the x402 specification in 2025 to give that status code a concrete semantics for the era of autonomous AI agents, where API consumers are software, not humans, and the natural unit of payment is a stablecoin transfer rather than a card swipe.
How does the x402 flow work?
A complete x402 request-response cycle looks like this:
1. Agent → API: GET /api/data
2. API → Agent: HTTP 402 Payment Required
WWW-Authenticate: Payment realm="api.example.com"
PAYMENT-REQUIRED: { asset: USDC, amount: 5000, network: base, recipient: 0x... }
3. Agent signs an EIP-3009 USDC transferWithAuthorization
4. Agent → API: GET /api/data
PAYMENT-SIGNATURE:
5. API → Facilitator: POST /verify + /settle
6. Facilitator settles the USDC on-chain (~2-4s on Base)
7. API → Agent: 200 OK + actual response + Payment-Receipt header
The whole flow is one HTTP retry from the agent's perspective. There is no merchant account, no card network, no chargeback window. The facilitator can be the canonical Coinbase CDP facilitator (USDC on Base) or any compliant alternative — for example AsterPay's EU facilitator that adds EUR EUR settlement on top.
What problem does x402 solve?
Card networks were designed for human checkout. They assume a person fills in a form, accepts a fee, possibly gets called by a bank to confirm. None of that fits an autonomous agent that needs to call ten APIs in 200 milliseconds to answer a single user prompt. x402 collapses the payment into the same HTTP round-trip as the API call itself: pay-per-call, sub-second, with no merchant-side integration beyond returning a 402.
What is the difference between x402 and MPP?
x402 (Coinbase) and MPP — the Machine Payments Protocol from Stripe and Tempo — are two parallel open standards that both use HTTP 402. The wire formats differ slightly:
| x402 | MPP | |
|---|---|---|
| Initiated by | Coinbase | Stripe / Tempo |
| 402 header | PAYMENT-REQUIRED | WWW-Authenticate: Payment |
| Settlement header | PAYMENT-SIGNATURE | Authorization: Payment |
| Default facilitator | Coinbase CDP | Stripe / open |
| Schemes | exact, lightning | exact, mpp-v1 |
Most production servers, including AsterPay, return both headers in every 402 response so an agent can use whichever SDK it already has installed. The two standards are converging in practice; the differences are skin-deep.
What chains and stablecoins does x402 support?
The x402 "exact" scheme works on any EVM chain with an EIP-3009 USDC implementation. Production support today: Base (primary), Ethereum mainnet, Polygon, Arbitrum and Optimism. The Solana scheme is in active development. Bitcoin Lightning is supported via a separate scheme using BOLT11 invoices — AsterPay runs a live Lightning x402 endpoint at @[email protected].
Who runs x402 in production?
- Coinbase CDP — the default facilitator for USDC on Base.
- AsterPay — EU-regulated facilitator with EUR EUR settlement via SEPA Instant.
- Tempo — Stripe-backed payments network with native MPP/x402 support.
- Bazaar — Coinbase's auto-discovery directory of x402-enabled APIs.
How do I get started with x402?
- As an agent:
npm install @x402/fetchorpip install x402. Wrap your fetch client withwrapFetchWithPaymentand you are done — 402s become automatic on-chain payments. - As a merchant: install an x402 middleware (Express, Fastify, FastAPI, Next.js all have community packages) and configure your facilitator. Five lines of code and your endpoint accepts agent payments.
- As an EU merchant who needs EUR: point your facilitator at x402.asterpay.io. Same flow, EUR lands in your bank.