x402 from zero

Lesson 1 is saved.

The status code that waited

Charged$0.00

Make a free account to keep going. Next is The status code that waited, about 6 minutes.

Tick any you’d like. All start off.

No password and no card. We use your email to sign you in and for the choices you tick. Your lesson 1 progress moves to your account.

Not now

The status code that waited

6 minutes. Checked 14 October.

In this lesson

  • Every web answer starts with a status code. 402 means Payment Required, and it sat unused for decades.
  • x402 gives 402 a job: the server names a price that software can read and pay on the spot.
  • The price is paid in USDC, a digital dollar, so one request can cost a tenth of a cent.
Go through it step by step

You already know 404

This lesson is about a web status code that waited almost thirty years for a job.

Open a page that doesn’t exist and you get 404 Not Found. That number is a status code. Another code, 402, means Payment Required. You have probably never seen it.

402 Payment Required has been in the web’s rules since the 1990s. Why have you probably never seen it?

Your choice is checked as soon as you pick it. With a keyboard, move with the arrow keys and press Space to choose.

Right.

Not quite.

The rules set 402 aside “for future use” and never said how a payment should work, so nothing used it.

A code with a name and no instructions

A draft of the web’s rules from 1992 already had the idea: the site says how it can be paid, and the visitor’s browser asks again with payment attached.

That part never made it in. Every version of the rules since 1997 has called 402 “reserved for future use”, and said nothing more.

Each version of the rules, in its own words.

Show the real messageHide the real message
1992  Early W3C draft of HTTP status codes
"The parameter to this message gives a specification of charging schemes acceptable. The client may retry the request with a suitable ChargeTo header."

1996  RFC 1945, HTTP/1.0
402 is not listed. 401, 403, 404 and 501 are.

1997  RFC 2068, HTTP/1.1
"This code is reserved for future use."

1999  RFC 2616, HTTP/1.1 revised
"This code is reserved for future use."

2014  RFC 7231
"The 402 (Payment Required) status code is reserved for future use."

2022  RFC 9110, the current standard
"The 402 (Payment Required) status code is reserved for future use."

Why it waited

To use 402 for real, a site needs to say “pay me a tenth of a cent” and get paid in seconds, with no account, no card form and nobody typing anything. Cards don’t go that low: Stripe’s minimum when a program pays by card is $0.50 (14 Oct) source, 500 times the price you are about to see.

x402’s answer is USDC, a digital dollar. It is a stablecoin: Circle issues it, each one can be swapped for one US dollar, and it moves between wallets on a blockchain network such as Base, which Coinbase built.

x402 gives 402 a job

The site names a price, and software reads it and pays on the spot, with no account and no card form. x402 was created at Coinbase and announced in May 2025, and the version in use today, version 2 (14 Oct) source, came out in December 2025.

A real 402

Here is a real one, from 14 October 2026. We asked a weather service that charges through x402 for London’s weather, and paid nothing. It answered 402 Payment Required, with a price tag.

Our request, and the 402 that came back.

Show the real messageHide the real message
GET /weather?city=London HTTP/1.1
Host: x402.agentindex.world

The site answers:

1HTTP/1.1 402 Payment Required
Date: Wed, 14 Oct 2026 11:28:13 GMT
Content-Type: application/json
2payment-required: eyJ4NDAyVmVyc2lvbiI6MiwiZXJyb3IiOiJQYXltZW50IHJlcXVpcmVkIiwicmVzb3VyY2UiOnsidXJsIjoiaHR0cHM6Ly94NDAyLmFnZW50aW5kZXgud29ybGQvd2VhdGhlciIs…
cache-control: no-store

{"x402Version":2,"error":"Payment required","resource":{"url":"https://x402.agentindex.world/weather", …},"accepts":[ … ]}
  1. Note 1: The status code. The server wants paying before it answers.
  2. Note 2: The price and how to pay, packed into one line of 3,456 characters, cut short here, as is the body. Header names ignore upper and lower case, so this is the header the x402 spec writes as PAYMENT-REQUIRED.

What the 402 asks for

The 402 carries a price tag that software can read. It asks for $0.001 in USDC on Base, paid into the seller’s wallet within five minutes. USDC counts in millionths of a dollar, so the price is written as 1,000 units.

The price tag, as software reads it.

Show the real messageHide the real message
1"accepts": [
{
2  "scheme": "exact",
3  "network": "eip155:8453",
4  "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
5  "amount": "1000",
6  "payTo": "0xb3F32bdfe8D07825BC0D7387295aB1D7559BA69d",
7  "maxTimeoutSeconds": 300,
8  "extra": { "name": "USD Coin", "version": "2" }
}
]
  1. Note 1: The ways this seller takes payment. A seller can list several, such as the same price on Base and on Solana, and the program picks one. The 1992 draft called them “charging schemes acceptable”.
  2. Note 2: “exact” means a fixed price. The other common scheme, “upto”, lets a seller charge for actual use up to a cap.
  3. Note 3: Base. The number is Base’s chain ID.
  4. Note 4: The address of USDC on Base.
  5. Note 5: 1,000 millionths of a dollar, which is $0.001.
  6. Note 6: The seller’s wallet, where the money lands.
  7. Note 7: The payment has five minutes to complete.
  8. Note 8: “USD Coin” is the token’s official name, which the payer’s signature has to include.
The real 402 in this lesson asks for an amount of “1000” in USDC. What price is that?

Your choice is checked as soon as you pick it. With a keyboard, move with the arrow keys and press Space to choose.

Right.

Not quite.

USDC counts in millionths of a dollar, so 1,000 units is $0.001, a tenth of a cent.

After the 402

There’s no checkout page. The program reads the price, signs a payment for exactly $0.001 from its own wallet, and sends the same request again with the signed payment attached. The site has a facilitator check the signature and move the USDC. Then it answers 200 OK with the weather and a receipt.

Example. The same service points to a free sample at /weather/sample in its own description. A free sample beside a paid call lets a person or an agent check the data before paying for it.

A program gets a 402 with a price. What does it do next?

Your choice is checked as soon as you pick it. With a keyboard, move with the arrow keys and press Space to choose.

Right.

Not quite.

The program signs a payment that matches the price and repeats its request with the payment attached, in a header called PAYMENT-SIGNATURE.

Who meets a 402 today

The one asking is usually a program, often an AI agent working for someone. That’s why most people never see a 402 in their browser.

Cloudflare’s pay per crawl, launched in beta in July 2025, also answers some AI crawlers with a 402 and a price, using its own price headers, with Cloudflare billing the crawler. Cloudflare’s post introducing it called 402 “a mostly forgotten piece of the web.”

In the next lesson you play the program and buy one rainfall reading for $0.001, step by step.

Lesson done.

Price: about 6 minutes of your attention.

You can now say

  • Every web answer starts with a status code. 402 means Payment Required, and it sat unused for decades.
  • x402 gives 402 a job: the server names a price that software can read and pay on the spot.
  • The price is paid in USDC, a digital dollar, so one request can cost a tenth of a cent.

Sources

Checked 14 October

  1. W3C, Status codes in HTTP (historic document, 1992) w3.org
  2. RFC 1945, HTTP/1.0 (May 1996) rfc-editor.org
  3. RFC 2068, HTTP/1.1, section 10.4.3 (January 1997) rfc-editor.org
  4. RFC 2616, HTTP/1.1, section 10.4.3 (June 1999) rfc-editor.org
  5. RFC 7231, section 6.5.2 (June 2014) rfc-editor.org
  6. RFC 9110, HTTP Semantics, sections 5.1 and 15.5.3 (June 2022) rfc-editor.org
  7. x402.org feed: x402 announced 6 May 2025, V2 on 11 December 2025 x402.org
  8. Cloudflare press release: Erik Reppel, creator of x402 and Head of Engineering for Coinbase Developer Platform (23 September 2025) cloudflare.com
  9. x402 v2 specification, HTTP transport (PAYMENT-REQUIRED, PAYMENT-SIGNATURE, PAYMENT-RESPONSE) github.com
  10. x402 reference SDK: default asset on Base is USDC with 6 decimals github.com
  11. Coinbase Bazaar search, weather services (source of the captured endpoint) api.cdp.coinbase.com
  12. Stripe docs, Machine payments: $0.50 card minimum, 0.01 USDC stablecoin minimum docs.stripe.com
  13. Circle: what USDC is circle.com
  14. Base docs: built by Coinbase docs.base.org
  15. Cloudflare blog: Introducing pay per crawl (1 July 2025) blog.cloudflare.com