HTTP 402 & x402: The Web's Payment Code Finally Works (2026)
Reserved since 1991, HTTP 402 sat unused for 33 years. Now x402 ships the client half — so AI agents can pay per request. Here's how it works and why it matters.
The internet had a payment status code for 33 years. Nobody used it. Until now.
HTTP 402 Payment Required has been in the spec since 1991. It was reserved. Servers couldn't actually charge for a request because the client half of the protocol was missing. No browser knew what to do with a 402. No client library could sign and replay. The status code sat in RFC 7231 with the word "experimental" next to it.
What x402 actually does
x402 is the missing client half. The protocol shipped in 2025. Here is what a paid request looks like end to end:
- Client calls a paid endpoint with no auth.
- Server returns 402 with a JSON body that includes
accepts[], the array of acceptable payment options. Each option carriesscheme(exact, upto),network(CAIP-2, e.g.eip155:8453for Base),amount(atomic units),asset(USDC contract on Base),payTo(recipient wallet),maxTimeoutSeconds, andextra(the EIP-712 domain name and version for the asset). - Client picks an option. The wallet signs an EIP-3009
TransferWithAuthorizationover those exact terms. - Client base64-encodes the signed payload and replays the request with an
X-PAYMENTheader. - Server verifies the signature, settles the transfer on-chain via a facilitator, and serves the response.
The whole flow is HTTP. No new infrastructure. Your existing API gets paid endpoints by emitting a 402. Your client library learns to sign and replay. That is it.
Why now
Agents need a payment primitive that does not require accounts. Stripe and the rest of the SaaS billing stack assume a human is at the door. Wallets do not. A wallet signing typed data is a clean, programmable, account-less primitive that any agent can use.
For the supply side, x402 turns a single endpoint into a paid endpoint with one HTTP middleware. No new vendor relationship. No new contract. No new auth surface. The agentic.market directory indexes the providers so agents can discover them.
I built a paid memory API on top of this. The Coinbase CDP facilitator handles on-chain settlement on Base. The whole round-trip is three seconds.
Watch it move real money: bmdpat.com/memory/demo
What I had to learn the hard way
CDP's V2 facilitator enforces an undocumented minimum payment threshold somewhere between 100 and 1000 atomic USDC. Below the floor, V2 verify rejects with a generic invalid_payload and no message. The V1 endpoint with the same body said "amount is too low." Took three PRs of payload-shape fixes to figure out the body was always fine and the number was the bug. Bumped my prices to a uniform $0.001 per call and the rejections went away.
If you are building on x402 and getting invalid_payload from CDP, the first thing to try is bumping the amount.
What's next
The next problem isn't whether agents can pay. It's giving them a budget.
A typical 4-tool agent loop hits five priced endpoints per turn. A long-running task does this thousands of times a day. A single rogue loop drains a wallet in minutes. Per-tool caps, per-agent budgets, kill switches, spend visibility — that's the next layer.
FAQ
What is HTTP 402 Payment Required?
402 is a reserved HTTP status code for payment-gated resources. It sat mostly unused for decades until protocols like x402 gave clients a real way to pay and retry.
What is x402?
x402 is a protocol that uses HTTP 402 so a client can pay for a request, often with a stablecoin transfer, then retry and get the resource. It suits agent-to-API payments.
Get the Local AI Field Kit
Four copy-ready tools now, then measured local AI field notes M-F only when there is something worth sending.
Free. One-click unsubscribe. No sponsored placements. Your email is used only for these notes.
Patrick Hughes
Building BMD HODL — a one-person AI-operated holding company. Nashville, Tennessee. Twenty-Two agents.
More writing
- 5 min
Why API keys break for autonomous AI agents
Stripe doesn't ship to LLMs. Every vendor signup form assumes a human at the door. Here is what changes when wallets become the access primitive.
- 4 min
I built a memory API that AI agents can pay for
An LLM just paid me $0.001 to remember something. The agent has no account, no API key, no credit card. It just signs a USDC transfer and gets back a 200.
- 6 min
Your Agent's Audit Trail Cannot Be Retrofitted
Agent logs show activity. They do not prove the outcome an agent claimed. Here is the verification layer I added after an agent reported two false dones.
- 6 min
My Agents Have to Prove What They Did
I extracted the claims ledger that runs my agent operation into showwork. Falsifiable claims, deterministic checks, and an exit gate that refuses a false done.
- 6 min
When Claude hits a weekly limit, your agent fleet still needs a third CLI
Claude and Codex both went dark. Here is the tertiary Gemini path I wired, with honest qa_reviewer stamps.