Every web developer knows the common HTTP status codes. 200 means OK. 404 means not found. 500 means something broke on the server.
But there's one status code that has been sitting in the spec since 1997, completely unused: 402 Payment Required.
The original HTTP spec reserved it "for future use." Almost 30 years later, Coinbase is finally putting it to work with a new open protocol called X402.
It could change how we pay for things on the internet.
The Problem with Traditional Payment Platforms
If you've ever built an API or digital product, you know the pain of monetizing small transactions.
Stripe, the most popular payment processor, charges roughly 2.9% + 30 cents per transaction. That works great for a $50 purchase. But for a 1-cent API call? You'd lose money on every single request.
This creates a broken incentive structure:
- Developers can't charge per-request for cheap API calls
- Products get forced into monthly subscriptions or credit bundles
- Users pay for access they don't fully use
- Small creators and indie developers get locked out of monetization entirely
The web has no native way to handle micropayments — tiny transactions measured in fractions of a cent.
What Is X402?
X402 is an open protocol built by Coinbase that uses the HTTP 402 status code to enable native payments on the web.
The idea is simple: instead of requiring users to set up accounts, enter credit cards, or buy credits in advance, a server can simply respond with a 402 Payment Required status — and the client's wallet handles the rest automatically.
The Flow
Here's how a typical X402 transaction works:
- Client sends a request to a paid endpoint
- Server responds with 402 — including payment details (amount, address, network)
- Client's wallet signs a payment using stablecoins (like USDC on Base)
- Client resends the request with a payment header attached
- Server verifies the payment and returns the response
The entire flow happens in seconds, with no redirects, no checkout pages, and no middlemen taking 30 cents off the top.
How It Works for Developers
One of the most compelling things about X402 is how little code it takes to implement.
On the server side, it's essentially one line of middleware:
- Install the X402 SDK
- Configure which routes require payment and how much they cost
- Add the middleware to your server
The middleware intercepts requests, checks for a valid payment header, and either returns a 402 or lets the request through.
On the client side, developers use the X402 fetch library — a wrapper around the standard fetch API that automatically handles 402 responses and wallet interactions.
What developers need to configure:
- A wallet — to receive payments
- Pricing — how much each endpoint costs (can be fractions of a cent)
- Network — which blockchain to use (Base is the default)
That's it. No Stripe dashboard. No webhook handlers. No subscription billing logic.
Programmatic Payments and AI Agents
This is where X402 gets really interesting.
Because the payment flow is entirely programmatic — no human clicking "pay now" — it's perfectly suited for machine-to-machine transactions.
Think about the world of AI agents. An AI agent browsing the web, calling APIs, and completing tasks needs a way to pay for services automatically. It can't fill out a checkout form.
With X402:
- An AI agent can call a paid API and pay per request
- Agents can pay other agents for services
- Costs stay microscopic — fractions of a cent per interaction
- No API keys, no accounts, no subscriptions — just crypto payments in the HTTP layer
This creates a foundation for an AI agent economy where autonomous systems can transact with each other seamlessly.
The combination of stablecoins (so prices stay predictable) and Layer 2 networks like Base (so fees stay near zero) makes this practical for the first time.
Will It Actually Work?
X402 is still early. There are real questions:
- Adoption — will enough developers and platforms implement it?
- Regulation — crypto payments face varying legal treatment worldwide
- User experience — mainstream users still aren't comfortable with wallets
- Competition — traditional payment rails are improving too
But the core insight is hard to argue with: the web needs a native payment layer, and HTTP already reserved a status code for it three decades ago.
Coinbase is betting that crypto — specifically stablecoins on fast L2 chains — is finally the technology that makes 402 useful.
The internet was built with a slot for payments and left it empty for 30 years. X402 is Coinbase's attempt to finally fill it in.