x402 payments protocol
x402 is an open protocol for internet-native payments that uses the long-reserved HTTP 402 Payment Required status code as a payment handshake between clients and servers. It is maintained by the Coinbase Developer Platform but positioned as a neutral, open standard.
How it works
Section titled “How it works”When a client requests a paid resource, the server responds with HTTP 402 and a payment challenge describing the amount, accepted schemes, and destination. The client pays and retries the request with a proof-of-payment header; the server verifies and returns the resource. The flow is entirely HTTP-native — no SDKs, auth tokens, or out-of-band coordination are required.
Client ──GET /resource──▶ ServerClient ◀── 402 + payment challenge ── ServerClient ──pay on-chain / stablecoin──▶Client ──GET /resource + X-PAYMENT proof──▶ ServerClient ◀── 200 OK + resource ── ServerWhy it matters
Section titled “Why it matters”- No accounts or API keys — removes signup, KYC, prepaid credits, and key rotation
- Agent-friendly — autonomous AI agents can pay for API calls without human-operated billing
- Scheme-agnostic — supports multiple networks and payment schemes (stablecoins on EVM chains are the primary focus)
- Per-request micropayments — enables pricing models (fractions of a cent per call) that are infeasible with card rails
Technical notes
Section titled “Technical notes”- Scheme negotiation happens inside the
402response body; servers advertise which networks/tokens they accept - Proof-of-payment is carried in a request header on retry — typically an on-chain tx hash or signed authorization
- The spec supports
exactanduptopayment modes for fixed-price and metered usage - Reference implementations and middleware exist for Express, Fastify, Hono, and Cloudflare Workers
Sources
Section titled “Sources”- x402.org — official protocol site, spec, and implementations (accessed 2026-04-10)
- HTTP 402 on MDN — original HTTP status code reservation