What does HTTP 402 Payment Required mean?
It means “pay first”. The server would answer the request, but it costs money and no acceptable payment came with it.
For a long time that was all. RFC 9110, the HTTP standard, has one line on it: the status code “is reserved for future use”. There is no standard way to say what to pay, how, or to whom.
A 2026 Internet-Draft proposes a meaning. The resource “requires payment”, and “no acceptable payment has been made”. The draft says a server sending 402 should tell the client how to pay, in headers or in the body. It is a draft, not a standard yet.
Who sends 402 today?
Each service gives it its own meaning:
| Who | What the 402 means | What comes with it |
|---|---|---|
| Stripe’s API | “Request Failed”: the parameters were valid, but the request failed | an error object that says why |
| Cloudflare pay per crawl | an AI crawler must pay for the page | a crawler-price header; the crawler retries with crawler-exact-price or crawler-max-price |
| x402 | this request costs money, payable on chain | a PAYMENT-REQUIRED header with the price, the token and who gets paid |
So the fix depends on the sender. Read the response’s headers and body before anything else.
How do I fix a 402 Payment Required error?
- Read what came with it. A price header means the service wants a payment for this request. An error body or error header says why the request failed.
- If it is x402, pay and retry. Decode the
PAYMENT-REQUIREDheader, check the price against your limit, sign, and send the request again withPAYMENT-SIGNATURE. The x402 client libraries do this for you. - If it is a payment API, read the error code. It says what to fix on the account, and a plain retry usually fails again.
- In an agent, cap the spend before it signs. A tool that pays on every 402 will pay whatever it is asked.
What is x402?
x402 is an open protocol that turns 402 into a payment flow over HTTP. The price, the payment and the receipt each travel in a header, base64-encoded JSON. A facilitator checks the payment and settles it on chain, so the server can leave the chain work to it.
In the flow below, the agent has no account with the service. It only needs a wallet that holds the token. For the other ways agents pay, such as cards with limits, see how AI agents pay.
What does a real 402 → pay → 200 look like?
We ran one payment on a local chain, with the x402 SDK’s server and facilitator, and logged every request and header:
How we measured: one payment on 2026-10-21, local Anvil 1.8.3 as chain 84532, the x402 SDK’s server and facilitator in the same process, @x402/core 2.28.0, @hashspan/x402 1.3.1.
Three things stand out:
- The first answer is fast and free. The 402 took 2 ms and carried only the price. Nothing was signed yet.
- The agent never sends a transaction. It signs a transfer authorization (EIP-3009), and the facilitator puts it on chain.
- The 200 carries the proof.
PAYMENT-RESPONSEnames the transaction, so the client can check the payment on chain.
The paid request took 1035 ms because the server waited for the settlement before it answered. Most of that wait was the facilitator checking for the receipt once a second, viem’s default for Base. With checks every 50 ms, the paid request took about 76 ms (x402 vs MPP). On a public network, it also waits for a block.
What changed from x402 v1 to v2?
| Part | v1 | v2 |
|---|---|---|
| Price on the 402 | JSON body | PAYMENT-REQUIRED header |
| Payment from the client | X-PAYMENT header |
PAYMENT-SIGNATURE header |
| Settlement result | X-PAYMENT-RESPONSE header |
PAYMENT-RESPONSE header |
| Network names | base-sepolia |
CAIP-2 ids, eip155:84532 |
In both, a failed settlement comes back as another 402. PAYMENT-RESPONSE (X-PAYMENT-RESPONSE in v1) then says success false, with an errorReason such as insufficient_funds. Sources: the v1 and v2 HTTP transport specs.
How do I see x402 payments in a trace?
In plain words: the agent’s tool can say “done” while the payment failed. A trace puts the payment next to the step that made it, so you can tell.