x402: the forgotten HTTP code that could become how machines pay each other
I spent about ten years as a developer before moving into product. Then I worked in Web3 at Chiliz and lived through the DeFi explosion up close: the excitement, the hype, the projects that disappeared, and the few ideas that actually stuck. Today I’m a product manager in iGaming, an industry where payments are one of the biggest costs and one of the biggest headaches.
That background makes me skeptical of most “this will change payments forever” claims. But every now and then something shows up that looks less like hype and more like plumbing. x402 is one of those. I’m convinced it’s a strong candidate for how AI agents, bots and automated systems will pay for things online, and over the next few days I’m going to try it hands-on. This post is the starting point.
The idea is built on a detail most people never noticed. HTTP has had a status code 402, “Payment Required”, since 1997. It was reserved “for future use”, for the day the web got its own way of handling money. That day never really came: paying online still means going through intermediaries that take a cut before anything happens.
Where it comes from
x402 was created by Coinbase, which announced it in May 2025 together with a whitepaper. In September 2025 Coinbase and Cloudflare set up the x402 Foundation, and Cloudflare added x402 support to its Agents SDK and MCP servers. In April 2026 governance moved to the Linux Foundation, with founding members including Google, Visa, Mastercard, Stripe, AWS and Circle. So it started as a crypto company’s project, but it’s now an open standard backed by payment networks and cloud providers. Coming from Web3, that’s the part that caught my attention: this isn’t crypto trying to replace the existing system, it’s the existing system adopting a crypto rail.
The problem it solves
Card processors charge a fixed fee per transaction, on top of a percentage. That’s fine for a €50 purchase. For a €0.01 API call it’s absurd: the fee is many times the price, so you lose money on every request.
The usual workaround is to add layers: the user creates an account, logs in, verifies a card, buys a subscription or a pack of prepaid credits, and tops it up when it runs out. It works, but it’s heavy for the seller, annoying for the buyer, and basically unusable for a machine.
How x402 works
x402 makes payment a step of the HTTP request itself, settled in stablecoins such as USDC:
- A client requests a resource: an API endpoint, a file, an article.
- The server answers
402 Payment Required, with the price, the network and where to pay. - The client signs a payment and repeats the request with the proof attached.
- The server verifies it and returns the resource.
No account, no API key, no subscription, no checkout page. One request, one payment. The protocol itself takes no fee; what’s left is the network cost, which on cheap chains is a fraction of a cent.
What struck me is how little code it takes. On the seller side, in Node.js, it’s essentially one middleware in front of the route you want to charge for. You configure your wallet address, the route, the price, how long the buyer has to pay and which network to use. That’s the whole integration.
On the buyer side there are two paths. A person in a browser gets a page asking to connect a wallet such as MetaMask or Coinbase Wallet, pays, and receives the content. A program, or an AI agent, uses a fetch wrapper that sees the 402, pays automatically and retries the request. That second path is the one that matters to me.
Why I think this is the future of machine payments
Today’s payment infrastructure assumes a human: someone who signs up, enters a card, accepts terms, clicks “pay”. An AI agent working on a task doesn’t fit that model. If it needs one piece of data from a paid API, it shouldn’t need someone to create an account and buy a monthly plan first.
- Micropayments become viable. Charging a cent per call finally makes economic sense.
- It’s built into HTTP. No new transport. The same handshake also runs over MCP and agent-to-agent protocols.
- Machines can pay machines. One agent buys a service from another, with no human in the loop, within limits someone defined.
DeFi taught me that programmable money is powerful and that it also fails in creative ways. An agent that can spend money is an agent that can waste it, fast. Spending caps and dedicated wallets aren’t optional.
A thought on iGaming
Working in iGaming, I can’t help looking at this through that lens. This part is a hypothesis, not a conclusion: I haven’t done the research yet.
Gambling is classified as high-risk, so card processing is expensive, and operators stack PSPs and orchestration layers to keep approval rates up. Stablecoins are already arriving: in April 2026 Paysafe launched crypto deposits for US iGaming operators, powered by MoonPay. But they arrive through the same chain of intermediaries.
x402 suggests a different shape. If payment is a native step of an HTTP request, part of what PSPs do today could shrink: a deposit, a pay-per-call data feed, a fee between a platform and a game provider, an affiliate payout. B2B flows between operators, providers and affiliates look like the most realistic starting point to me.
The obvious limits: PSPs don’t just move money. They handle KYC, AML, fraud, chargebacks and responsible gambling controls, and regulation varies a lot by market, with some regulated markets restricting crypto for licensed operators. So I don’t see PSPs disappearing. I see some of their role being reduced, or changing into something closer to an x402 facilitator. I’ll dig into this properly and write a separate post if I find something solid.
It’s not the only bet
To be fair, x402 has company. L402 from Lightning Labs has used 402 with Bitcoin Lightning payments since 2020. Stripe and Tempo launched the Machine Payments Protocol (MPP) in March 2026. Card networks are building their own agent payment layers. And current volumes are still closer to experiments than real infrastructure. My bet isn’t that x402 wins for sure, but that payments native to HTTP, designed for machines, are where this is going, and x402 is currently the most open and most adopted attempt.
What I’m going to build
Reading about it is fine, but I want to see how it behaves. In the next days I’ll put together a few small prototypes, purely for demonstration, on a testnet with a burner wallet:
- A pay-per-call API. A tiny endpoint on my home server that charges a cent per request. The “hello world” of x402.
- An agent that pays on its own. An AI agent with its own wallet and a spending cap, that hits the paid API, gets the 402, pays and continues the task.
- A paid MCP tool. A tool an assistant like Claude can call, where every call costs a few cents.
- Bot-to-bot. Two agents: one sells a service (say, a summary or a data lookup), the other buys it. No humans involved.
- Pay-per-article on this blog. One post unlocked for a few cents, by a human or by an AI crawler. An alternative to ads and paywalls.
I’ll write about what works, what breaks, and whether the developer experience is really as simple as it looks on paper.
Further reading
- Why Luxembourg should be interested in x402 (Paperjam): Coinbase’s May 2025 launch and the case for agent payments.
- Cloudflare blog on x402: the x402 Foundation and x402 support in Agents SDK and MCP servers.
- How AI agents are unlocking HTTP 402 as a payment standard (21Shares): history of 402 and a comparison of L402, x402 and MPP.
- x402: the HTTP payment protocol that lets AI agents spend money (Spark): adoption figures and the Linux Foundation move.
- What is the x402 protocol? (Dodo Payments): a technical walkthrough of headers, facilitators and payment schemes.
- Paysafe launches Pay with Crypto for US iGaming (Business Wire): stablecoins entering regulated iGaming.
Part of the spark for this post came from Fireship’s Code Report video on x402, worth a watch if you want the five-minute version.