Part 1 of 3 in Agent payments
Exploring the x402 Standard
x402 turns HTTP's long-dormant 402 status code into a way to pay for a single API call with stablecoins. What goes over the wire, who does what, and where it falls short.
Correction, November 2026. The first version of this post described x402 as a format for explaining authorization decisions. That was wrong: x402 is a payment protocol. This is a full rewrite.
HTTP has had a status code for "pay me" since the 1990s. 402 Payment Required was reserved for future use and then left there1, because the web never got a payment method a server could ask for in a response.
x402 is the attempt to finally use it. A server answers a request with a price2, the client pays in stablecoins and retries the same request, and the data comes back. No account, no API key, no invoice at the end of the month.
It started at Coinbase and launched in May 2025. Since July 2026 it has lived at the x402 Foundation under the Linux Foundation, with about 40 member organizations. The protocol charges no fee of its own; you pay the network's.
Why bother
Normal API billing assumes a person: sign up, add a card, copy a key, get a bill. That works when a developer picks a vendor once. It doesn't work for an AI agent that found a service a minute ago and needs one response from it.
It doesn't work for small amounts either. Card fees make it impossible to charge a tenth of a cent, so APIs sell subscriptions and prepaid credits instead. x402 makes a single request the thing you buy.
What goes over the wire
The exchange uses three headers, each carrying Base64-encoded JSON:
| Header | Sent by | Carries |
|---|---|---|
PAYMENT-REQUIRED |
Server, with the 402 | What it costs and how to pay |
PAYMENT-SIGNATURE |
Client, on the retry | The signed payment |
PAYMENT-RESPONSE |
Server, with the final answer | What happened at settlement |
Here's what PAYMENT-REQUIRED decodes to, trimmed from the spec's example:
{
"x402Version": 2,
"error": "PAYMENT-SIGNATURE header is required",
"resource": {
"url": "https://api.example.com/premium-data",
"mimeType": "application/json"
},
"accepts": [
{
"scheme": "exact",
"network": "eip155:84532",
"amount": "10000",
"asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
"payTo": "0x209693Bc6afc0C5328bA36FaF03C514EF312287C",
"maxTimeoutSeconds": 60,
"extra": { "name": "USDC", "version": "2" }
}
]
}accepts is a menu: a server can list several chains and tokens, and the client picks one it can pay with. network is a CAIP-2 chain ID3, here the Base Sepolia testnet. amount is in the token's smallest unit, so 10000 is 0.01 USDC.
The client signs a payment matching one entry and resends the same request with it in PAYMENT-SIGNATURE. The server answers with the data and a PAYMENT-RESPONSE holding the transaction hash.
Developers rarely touch any of this. A middleware does it: you declare a price per route, like "$0.001" on GET /weather, and it handles the rest.
The facilitator
Checking a payment and putting it onchain means running chain infrastructure, which most API authors don't want to do. So x402 lets the server hand both jobs to a facilitator, an optional service with two main endpoints.
/verify is read-only. For the default EVM method it checks that the signature recovers to the payer, that the payer has the balance, that the amount and validity window meet the requirement, and that the token and network match. Then it simulates the transfer.
/settle puts the transaction onchain and waits for it to confirm.
The facilitator never holds the money. The client's signature fixes the amount and the destination, so it can't change either. The public facilitator at x402.org only serves testnets, so production means picking another one or running your own.
Paying without gas
An agent shouldn't need a second balance just to pay for gas. On EVM chains the default path is EIP-3009: the client signs a transferWithAuthorization message4, the facilitator broadcasts it and pays the gas, and the tokens move straight from payer to payee.
Tokens without EIP-3009 go through Permit2 instead. That needs a one-time approval, which the user pays gas for unless a gas-sponsoring extension covers it.
Four ways to charge
exacttransfers a specific amount. This is the weather API case.uptoauthorizes a maximum, and the seller settles what was actually used, up to that cap. It suits anything priced by what the response turned out to cost.batch-settlementuses escrow and offchain vouchers, redeemed onchain in batches, for high-frequency use.auth-captureauthorizes a maximum and gives the payment a lifecycle: funds can be held, captured for less, voided or refunded.
Trade-offs
The server works before it's paid. In the default flow the order is verify, resource, settle, respond. A payment can pass verification and still fail settlement, and the spec doesn't give the server anything back when that happens. For a cheap response that's noise. For an expensive job it's real exposure.
Clients can't safely retry. Once PAYMENT-SIGNATURE is sent, the outcome is unknown until the server answers. The docs tell clients not to create a second payment automatically, and a settlement_pending error is "non-terminal, not permission to pay again." A timeout is harder to handle here than on a normal API call.
Confirmation is latency. With exact, every call waits for a chain confirmation. That's quick on a fast L2, but it's still slower than checking an API key.
Paying isn't permission. x402 says how to pay. It doesn't say whether this agent is allowed to spend, or whether the server on the other end is any good. Those are separate problems with separate protocols.
Where it fits
x402 is the settlement layer: it moves the money and nothing else. AP2 handles whether an agent may spend, ACP handles the checkout, and L402 is the real rival5, using the same status code over Lightning. The Agentic Payments Stack maps all of them. ERC-8004 covers the other question, which agent you're dealing with.
The appeal is how little it asks for. One status code, three headers and a signature, on top of HTTP, which everything already speaks.
Further reading
- x402 documentation: the concepts, SDKs and supported networks
- x402 specification: the V2 payload formats and the verify and settle steps
- The exact scheme on EVM: EIP-3009, Permit2 and what verification actually checks
- EIP-3009: transfers authorized by signature
- 402 Payment Required on MDN: the status code's own history
Notes
- 1Context
HTTP status 402 ("Payment Required") was reserved in the original HTTP/1.1 spec (RFC 2068) with the intention of supporting digital cash or micropayment schemes. It sat unused for over 25 years because no universal payment system materialized. The spec literally says: "This code is reserved for future use."
source → - 2Note
Despite 402's "reserved" status, it has seen informal adoption. Google APIs return 402 when a developer exceeds quotas. Shopify uses it when a store hasn't paid its fees. Stripe returns it for blocked payments. These uses are technically non-standard but demonstrate the demand for a payment-aware HTTP status code.
source → - 3Source
CAIP-2 is a chain-agnostic way to name a blockchain: a namespace plus a reference.
source →eip155:8453is Base, andsolana:...names a Solana cluster. It's why onenetworkfield can describe any ecosystem x402 supports. - 4Source
EIP-3009 lets a token holder sign a transfer that someone else submits. The signature carries a validity window and a random nonce, so it can't be replayed, and whoever broadcasts it pays the gas without being able to change the amount or the recipient.
source → - 5Counter
L402 answers the same 402 with a macaroon and a Lightning invoice. Proof of payment lives in the credential, so no facilitator has to attest that anything settled. It avoids x402's facilitator entirely, at the cost of needing a Lightning wallet that returns payment preimages.
source →