← Learn

What is x402?

By Petteri Lehtola, Co-founder of AsterPay · Last updated 23 April 2026 · 4 min read
Answer x402 is an open payment protocol that uses the HTTP 402 "Payment Required" status code to let AI agents pay for API access in stablecoins, on-chain, in a single round-trip. Originally proposed by Coinbase in 2025, x402 is now supported by Coinbase CDP, Tempo, Stripe (via the parallel MPP standard) and an ecosystem of facilitators including AsterPay in the EU.

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:

x402MPP
Initiated byCoinbaseStripe / Tempo
402 headerPAYMENT-REQUIREDWWW-Authenticate: Payment
Settlement headerPAYMENT-SIGNATUREAuthorization: Payment
Default facilitatorCoinbase CDPStripe / open
Schemesexact, lightningexact, 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?

How do I get started with x402?

  1. As an agent: npm install @x402/fetch or pip install x402. Wrap your fetch client with wrapFetchWithPayment and you are done — 402s become automatic on-chain payments.
  2. 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.
  3. As an EU merchant who needs EUR: point your facilitator at x402.asterpay.io. Same flow, EUR lands in your bank.