Payment Protocols · 7 min read · 3 November 2026

x402 explained: how an AI agent pays per request

A server answers with HTTP 402, the agent signs a small stablecoin payment and retries. Here is the full flow, what the facilitator does, and where the risk sits.

The four-step flow

The agent requests a paid resource. The server replies 402 Payment Required with a JSON body stating the price, the network, the recipient address and a timeout. The agent signs a payment for that exact amount and retries the same request with the payment in a header. The server accepts, and settlement happens in the background.

What the facilitator does

A facilitator is the service that checks the signed payment is valid, submits it for settlement and tells the server the funds arrived. Splitting verification from the resource server means the seller does not need to run blockchain infrastructure, and the buyer does not need an account with the seller.

Why it suits agents

There is no signup, no API key to leak and no invoice to reconcile. Payment is per request and for the exact amount, so an agent can buy one search result instead of a monthly subscription it will not use. Prices are machine-readable, so a model can compare costs before it commits.

Where the risk sits

The protocol proves the payment; it does not prove the content was worth buying. An attacker can still sell junk, inflate prices or lure an agent into repeated paid calls. Cap the amount per request and per day, allowlist the endpoints an agent may pay, and log every 402 it encountered, not only the ones it paid.

Before you turn it on

Give the agent a dedicated wallet with a small balance rather than a shared treasury. Test against a facilitator in a testnet first, and confirm what happens when a payment settles but the server never returns the resource.