DEV Community

Cover image for "x402 for Developers: The 30-Year-Old HTTP Status Code Now Taking Crypto Payments"
ScriptMasterLabs
ScriptMasterLabs

Posted on

"x402 for Developers: The 30-Year-Old HTTP Status Code Now Taking Crypto Payments"

HTTP 402 — "Payment Required" — sat in the spec marked reserved for future use for nearly 30 years. In 2025, Coinbase's developer platform finally gave it a job: it's now the backbone of x402, an open protocol that lets software pay for API calls in crypto, per request, with no accounts, no API keys, and no checkout page.

If you're building for AI agents, this one matters. Agents can't fill out a Stripe checkout form. They can sign a payment and retry a request.

The flow, concretely
It reuses the HTTP machinery you already know:

Your code calls a paid endpoint with no payment, like any GET.
The server answers 402 Payment Required with machine-readable terms in a PAYMENT-REQUIRED header: which token, which chain, how much, the pay-to address, and an expiry.
Your client signs a payment authorization (USDC via EIP-3009 signature-based transfer — no separate approve transaction) and retries the same request with a PAYMENT-SIGNATURE header.
A facilitator verifies and settles on-chain, and the server returns your data plus a PAYMENT-RESPONSE header carrying the transaction receipt.
That's the whole protocol. Four steps, all inside standard HTTP semantics. The reason it composes so well with agents: the payment terms are machine-readable by construction. There's no HTML checkout page for a model to parse — the 402 is the invoice.

Try it: inspect a real x402 v2 manifest
No signup, no key. This returns the live payment terms for a real endpoint:

bash

curl https://squeezeos-api.onrender.com/api/marketplace | jq .
json

{
"free": true,
"provider_listing": {
"listing_fee_payment": {
"protocol": "x402-v2",
"asset": "USDC",
"network": "eip155:8453",
"payTo": "0xc29185fa176357612f3194735753e520e91adc46"
},
"listing_fee_usdc": "0.01"
}
}
What you're looking at: protocol version, settlement asset (USDC), network (eip155:8453 = Base), the receiver address, and the fee. One honest note — this endpoint returns HTTP 200 as a discovery doc. The actual 402 challenge (with the PAYMENT-REQUIRED header) only fires on paid routes. Reads here are currently free; the live x402 payment on this endpoint is the provider-listing fee.

The seller side in 30 seconds
To monetize your own API with x402 you need three things: your endpoint returning 402s with payment terms, a facilitator (the service that verifies signatures and settles on-chain — Coinbase runs a public one), and a pay-to address. You don't build checkout, accounts, or API-key management. The tradeoff: you're trusting the facilitator for settlement, and micropayment economics only work where gas is cheap — which is why nearly everything runs on Base or Solana, settling in USDC (99.6% of x402 value per TRM Labs).

Two caveats the hype posts skip
Most x402 volume isn't agentic. TRM Labs' September 9 analysis of ~198.9M x402 settlements (~$52.7M since May 2025) found that after screening out wash and test flows, only 0.6–7.5% of the value looks genuinely agentic. A cron job with a wallet runs the same flow as an AI agent — the protocol doesn't require intelligence, just a signature. (TRM also admits the method likely undercounts: a single-purpose agent buying one feed daily is indistinguishable from a script on-chain.)

Settlement is not delivery. The receipt proves money moved. It says nothing about whether the API returned correct data. If you're building agent commerce, verify the response payload independently — the payment layer won't do it for you.

This week in x402
Cardano joined the x402 SDK (Sept 21) — agents can now pay in ADA, not just USDC-on-EVM.
RippleX shipped XRPL AI Starter Kit v1.1 (Sept 17) with Stripe/Tempo MPP support; its x402 integration dates to June.
On the wilder end: HTTPBASE20, a memecoin on Base's new B20 native token standard, was launched through an x402 payment — an agent paid a 402 and the payment minted the claim. x402 as a launch primitive, not just a billing one.
Where to go deeper
The full writeup — with sources, the complete 4-step flow, and a seller-side how-to — lives here: https://scriptmasterlabs.com/x402-payment-protocol

If you're wiring x402 into an agent framework, start with the facilitator docs and a testnet faucet. The protocol is simple enough to prototype in an afternoon; the interesting engineering is all in what you do after the receipt comes back.

Top comments (0)