Home › Guides › x402 explained
Every payment rail humans use assumes a human is present: a signup form, a card number typed into a checkout, an API key copied from a dashboard. An autonomous agent has none of that — what it has is a wallet. x402 builds the payment flow around exactly that asset, reviving the long-reserved HTTP status code 402 Payment Required as a machine-readable price tag.
1. Call → challenge. The agent calls a paid endpoint with no payment. Instead of an error page, the server answers 402 with an accepts array stating the exact terms: asset (e.g. USDC), network (e.g. Base), amount, and the payTo address. The challenge is the price list — nothing to scrape, nothing hidden.
2. Sign. The agent's x402 client (such as x402-fetch) signs a transfer for precisely that amount from the agent's own wallet. No account was created; the wallet's signature is the identity.
3. Retry → result. The same request is retried with an X-PAYMENT header carrying the signed payment. A facilitator verifies and settles it on-chain, and the server returns the real response.
curl -i -X POST https://fiatdock.com/v1/offramp/session \
-H "Content-Type: application/json" -d '{"cryptoAmount": 50}'
That returns FiatDock's real 402 challenge — $0.05 USDC per session-creation call. Inspecting it costs nothing, and nothing is created or charged until a payment is attached, which also makes retries safe.
| Human-era mechanism | x402 equivalent |
|---|---|
| Signup form + email verification | None needed — the wallet is the identity |
| API key in a dashboard | The signed payment authenticates each call |
| Card on file / monthly invoice | Exact per-call price, settled on-chain at request time |
| Pricing page (for humans) | The 402 challenge itself, plus machine docs like llms.txt |
Pay-per-call suits actions, not browsing. An agent comparing options should browse free surfaces first — FiatDock keeps quotes (GET /v1/quote), order tracking and all discovery endpoints free, so the only paid moment is the one that creates real-world work: a cash-out session or a top-up session. MCP-native agents get the same flow as tools: npx fiatdock-mcp pays x402 automatically from AGENT_PRIVATE_KEY.
x402 needs a funded wallet — an agent with zero USDC can read challenges but not pay them (that's what an on/off-ramp is for). And a paid call is a real transaction: read each service's terms for what the fee buys. Here, every paid response and its retry semantics are documented in the OpenAPI spec.
More guides: The x402 off-ramp, explained · Widget vs custodial exchanges · MCP payments server · All guides
Eligibility: 18+, own-account rule (sender wallet and receiving bank account belong to the same person), Portugal + Transak-supported EU/EEA countries (not the UK or restricted jurisdictions — see Terms). Crypto is volatile; nothing here is investment advice.