Learn / Basics

How x402 works, step by step

Every x402 payment is two HTTP requests. The first one asks and gets a price. The second one pays and gets the answer. Here is what happens in between.

1. The first request gets a 402

The client calls the endpoint as normal. The server answers 402 Payment Required and describes what it accepts: the scheme (usually exact), the network, the asset, the amount, and the payTo address. In x402 v2 this travels in a PAYMENT-REQUIRED header; v1 servers put it in the JSON body under accepts. See the 402 response.

2. The client signs a payment

For USDC on Base the client signs an EIP-3009 transferWithAuthorization: "move this many USDC from me to payTo, valid between these two times, with this nonce". Signing costs nothing and moves nothing yet. See EIP-3009.

3. The second request carries the payment

The client resends the same request with the signed payment attached, in the PAYMENT-SIGNATURE header in v2 (X-PAYMENT in v1).

4. Verify, work, settle

The server hands the payment to a facilitator. Verify checks the signature, amount, payee, expiry and the payer's balance without touching the chain. If it passes, the server does the work. Settle submits the authorization on chain so the USDC actually moves. Our facilitator settles only after a real response exists, so a failed delivery is not charged. See verify vs settle.

5. The answer comes back

The server returns 200 with the result and a PAYMENT-RESPONSE header carrying the settlement receipt, including the transaction hash anyone can look up on chain.

Common questions

How long does an x402 payment take?

On our facilitator a verify verdict comes back in about 650 milliseconds as measured on our own traffic. Settlement then waits for the chain, which on Base is typically a couple of seconds.

What if the payment is invalid?

The server answers 402 again, nothing settles and nothing is charged. A good facilitator names the reason, for example AUTHORIZATION_EXPIRED or INSUFFICIENT_FUNDS.

Can the seller charge more than the price shown?

No. The payer signs a specific amount to a specific address. The authorization cannot be reused for a larger amount or a different payee.

Keep reading

What is x402?x402 verify vs settlex402 payment refusal codes and fixesAll x402 guides
See what our facilitator supports
LearnDocsSettlement policyEndpoint report