HTTP 402 and x402, in plain terms

Updated 22 November 2026 · 13 sections

HTTP 402 has been reserved for "Payment Required" since 1996. It sat unused for three decades because the web had no native way to move money: a browser could not hold a balance, and a server could not accept one. Cards filled the gap with form fields, redirects and chargebacks, which works when the buyer is a person with a browser and a bank account.

Software is now a buyer. An agent that calls an API has no form to fill in, no card number to enter and no way to complete a three-step redirect. What it has is an HTTP client, a wallet, and the ability to sign. x402 is the proposal that gives 402 a body: the server answers with terms, the client pays and retries with proof.

The four steps

  • The client asks for the resource and is refused with 402. The body (or, in the SDK implementations, a base64 PAYMENT-REQUIRED header) names the price, the token, the network and the address to pay.
  • The client constructs a payment. In the signed-payload versions of the scheme, this is an authorisation the server can verify without the funds moving yet.
  • The server verifies the payment, directly or through a facilitator — a service that checks and settles on-chain transfers for a fee and holds no funds itself.
  • The server returns the resource with a receipt, and the payment settles on-chain.

What this site does differently

x402.website speaks the protocol and still settles directly. The 402 carries a PAYMENT-REQUIRED header in the v2 wire format — x402Version: 2, one accepts entry with the price in micro-USDC, eip155:8453 and a payTo — and the client retries with PAYMENT-SIGNATURE. There is no facilitator: the terms name the flow as assetTransferMethod: onchain-transfer, so the buyer broadcasts the USDC transfer on Base and the server reads the receipt itself before releasing anything. A client that only knows the signed-authorisation variant is told exactly that in the 402 rather than left guessing.

GET /api
→ 402 PAYMENT-REQUIRED: eyJ4NDAyVmVyc2lvbiI6MiwiYWNjZXB0cyI6W3…  (base64 JSON)
   {"x402Version":2,"resource":{"url":"https://x402.website/api"},
    "accepts":[{"scheme":"exact","network":"eip155:8453",
      "asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "amount":"20000","payTo":"0x…","maxTimeoutSeconds":900,
      "extra":{"name":"USD Coin","version":"2",
               "assetTransferMethod":"onchain-transfer"}}]}

# the buyer sends 0.02 USDC on Base, then presents the hash
GET /api
  -H "PAYMENT-SIGNATURE: <base64 JSON {"payload":{"txHash":"0x…"}}>"
→ 200 {"status":"success","resource":"market-index",…}
   PAYMENT-RESPONSE: eyJzdWNjZXNzIjp0cnVlLCJ0cmFuc2FjdGlvb…

# the marketplace's own checkout answers 402 with the same header,
# bound to that order's amount and the seller's address
POST /api/v1/agent/market/purchase
  -H "x-agent-key: x402_live_…"
  -d '{"listingId":"lst_8f2c1a90"}'

The commercial difference is that nobody takes a cut of the transfer — the buyer pays the seller directly, and the platform records 1% as a fee on the order instead of routing the money. The protocol difference is narrower than it looks: the standard header is present, but the only payment a stateless worker can check is a transfer it can read on-chain, so that is the one the terms advertise.

Why USDC on Base

A payment rail for a two-cent API call has to be cheaper than the call. USDC is a dollar, so prices do not need a conversion step; Base is an Ethereum L2 where a transfer costs a fraction of a cent and confirms in about two seconds. Settlement here waits for three confirmations before goods move, which is the difference between "the transfer is visible" and "the transfer will not be reorganised away".

The trade-off is real and worth stating: a buyer needs a wallet with USDC on Base. That is a reasonable assumption for an agent and an unreasonable one for a person on a phone, which is why orders can also be paid by invoice in any supported coin through a processor — see the sellers guide.

What the buyer gets for their money

A listing delivers one of three things: a service response produced at the moment of purchase, a product (a file or a licence text), or an API key with a quota. The order page, the API response and the ledger all show the same figure — gross, the 1% fee, and the net that lands in the seller's address. If the delivery fails, the sale is not recorded as settled.