What is x402? HTTP 402 Payment Required for AI agents
What HTTP 402 Payment Required means, when servers send it today, and how x402 turns a 402 into a payment an AI agent makes inside the request.
The looot team · , updated · 9 min read
On this page
HTTP 402 Payment Required is the status code a server sends when it wants to be paid before it answers. For most of the web's history it had no agreed format. x402 is an open protocol that gives it one, so a client, often an AI agent, can pay for an API inside the HTTP request itself. The server answers 402 with its price, the agent signs a stablecoin payment and sends the request again, and the server returns the data. There is no account, no API key and no checkout page.
By the end you can handle a 402 in your own client, follow an x402 payment from request to settlement, and pick between x402, Stripe MPP and a prepaid balance for your agent.
What does HTTP 402 Payment Required mean?
HTTP 402 means the server wants payment before it serves the request, but the standard does not say how. RFC 9110, the current HTTP semantics spec, gives it one line: "The 402 (Payment Required) status code is reserved for future use" (RFC 9110, section 15.5.3). MDN calls it "a nonstandard response status code", created "to enable digital cash or (micro) payment systems" (MDN).
So each API that sends a 402 picks its own meaning. Shopify's Admin API, for example, returns 402 when "the requested shop is currently frozen", and the fix is for the shop owner to pay the outstanding balance (Shopify response codes).
402 vs 401, 403 and 429
The 402 status code sits next to three codes that look alike. The difference is what the client should do next.
| Code | RFC meaning | What the client does |
|---|---|---|
| 401 Unauthorized | the request "lacks valid authentication credentials" | sign in or send a valid key |
| 402 Payment Required | "reserved for future use" | read the body: pay, top up, or tell a person |
| 403 Forbidden | the server "understood the request but refuses to fulfill it" | stop, retrying will not help |
| 429 Too Many Requests | the client "has sent too many requests in a given amount of time" | wait, often for `Retry-After`, then retry |
The 401 and 403 lines quote RFC 9110, and 429 is from RFC 6585.
How should a client handle a 402 status code?
Never retry a 402 in a loop. Unlike a 429, waiting does not fix it. A client, or an agent, should:
- Read the response headers and body. The server's own format says what it wants.
- If a `PAYMENT-REQUIRED` header is present, the server speaks x402, and a wallet that supports x402 can pay and retry, as the next sections describe.
- If the body holds a checkout or billing link, stop and show it to a person. An agent should not pay a card checkout on its own.
- Log the code and the message, so a person can see why the run stopped.
What is x402, in one paragraph
x402 gives the 402 code a format for payment. x402.org calls it "an open, neutral standard for internet-native payments" (x402.org). Coinbase contributed it to the x402 Foundation, which the Linux Foundation launched on July 14, 2026 (announcement), and Stripe is among its members. The reference code is open source under the Apache 2.0 license, now in the x402 Foundation repository.
How an x402 payment works, step by step
The x402 repository lists the flow. In short:
- The agent sends a normal request, for example `GET /company?domain=stripe.com`.
- The server answers `402 Payment Required` with a `PAYMENT-REQUIRED` header. It holds, base64 encoded, the payment options it accepts: network, token, amount and where to pay.
- The agent picks one option and signs a payment payload with its wallet.
- The agent sends the same request again with a `PAYMENT-SIGNATURE` header that carries the signed payload.
- The server checks the payload, on its own or through a facilitator's `/verify` endpoint, then does the work.
- The server settles the payment through the facilitator and returns the data with a `PAYMENT-RESPONSE` header that holds the settlement result.
The agent never holds an account with the seller. Its wallet signature is the proof of payment, and the signed payload limits what can move. The repository says payment schemes "must not allow for the facilitator or resource server to move funds, other than in accordance with client intentions".
What a facilitator does in x402
A facilitator is the service that checks and settles payments so the seller's server does not talk to a blockchain itself. Coinbase runs one. Its docs say it "validates signed payments, screens transactions, submits settlement onchain", with OFAC checks (CDP facilitator).
- Networks: Base, Polygon, Arbitrum, Monad, World and Solana, plus their test networks.
- Tokens: any ERC-20 token on its EVM networks through EIP-3009 or Permit2, and SPL tokens on Solana.
- Price for the seller: the first 1,000 onchain transactions a month are free, then $0.001 each, and verification is free (CDP facilitator, read 2026-11-16).
x402.org itself says the protocol charges "zero protocol fees". Network fees and a facilitator's fee are separate.
Who accepts x402 today
Sellers can list x402 endpoints in Coinbase's Bazaar, which its docs call a marketplace for x402 endpoints. Coinbase says it "has processed more than 100 million x402 payments across Base and Solana" (CDP x402 overview).
On the buyer side, some agent wallets speak it:
- Ramp lets an agent pay x402 from "a separately funded x402 wallet", apart from its cards and funds (Ramp agent payments).
- The AgentCard CLI from Alchemy has an `x402 fetch` command that pays from its USDC wallet (AgentCard skill page).
To price an x402 endpoint per call, try the free x402 pricing calculator.
x402 vs Stripe MPP vs a prepaid balance
These are three ways for an agent to pay for an API, and the main difference is who has to act before the money moves. x402 and Stripe MPP, the Machine Payments Protocol from Stripe and Tempo, both put the payment inside the HTTP request, using a 402 response as the prompt. A prepaid balance moves the payment out of the request altogether, because a person adds credit once and the agent spends it call by call.
| x402 | Stripe MPP | Prepaid balance | |
|---|---|---|---|
| Account with the seller | None | None | One workspace |
| How the buyer pays | Tokens from a wallet, usually stablecoins | Stablecoins, cards through Stripe, Lightning and other methods | Card on a hosted checkout, paid by a person |
| When money moves | Each call, or batched with batch settlement | Each call, or in a session | Once per top-up |
| Who approves a payment | Nobody, the wallet signs | Nobody per call; a card token carries limits set in advance | A person, once per top-up |
| What the agent holds | A wallet key | A wallet key or a scoped card token | An API key |
| Getting money back | The `exact` scheme is irreversible, so the seller has to send a new transfer | No refund protocol; the seller pays a charge back itself, and unclaimed session funds return to the buyer | A miss is free unless its provider bills for it |
| Safe retries | The payment-identifier extension | Idempotency is part of the protocol | An idempotency key on each call |
| Accepted by looot today | No | No | Yes |
Sources, read 2026-11-16: x402 FAQ, x402 payment identifier, MPP overview, MPP vs x402, MPP refunds, Stripe machine payments, looot skill file.
Which one should you use?
If your agent needs to pay many sellers it has no relationship with, a protocol makes the most sense, because it can pay a stranger without signing up first. Choose x402 if you already hold stablecoins and the sellers you want accept it, and look at MPP if you need cards or if the seller is built on Stripe. You may not have to choose between them for long, since Stripe accepts stablecoin payments over both protocols and MPP's SDK can serve x402 clients on the same route.
If your agent mostly calls a known set of APIs for a company that pays by card, a prepaid balance is simpler. A person says yes once, the agent never holds a key that can move money, and finance sees one bill. The limit is that the agent stops when the balance runs out and needs a person to top it up, which is the cost of keeping that key out of its hands.
The payment method decides only how a call gets paid for, not which provider answers it, and our roundup lists every agentic payment method ranked by setup steps.
What it cannot do
x402 payments are token transfers, usually stablecoins. Its FAQ says it does not natively support card deposits or fiat off-ramps, although facilitators or third-party gateways can wrap it with on and off ramps, and the Linux Foundation describes the protocol's aim as covering types from cards to stablecoins. A buyer with cards and no wallet cannot use it directly today. The seller must accept it, and many data APIs do not yet. A signed payment cannot be reversed by a card network, so a buyer has no chargeback. On looot, x402 does not work today. If you want it, ask your agent to request it or send us feedback.
Try it
Prompt for your agent
Check how an API wants to be paid
For x402 marketplaces next to other API marketplaces, see RapidAPI alternatives for AI agents.
Questions
Keep reading
Agentic payments: 7 ways an AI agent can pay for an API
Agentic payments in 2026, ranked by setup steps: Stripe Link, x402, MPP, Slash, Ramp, AgentCard and Crossmint, and how each one would pay an API seller.
The looot team · · 10 min read
Machine payments protocol: Stripe MPP explained for agents
The Machine Payments Protocol (Stripe MPP) explained: the 402 flow, shared payment tokens, Link's wallet for agents, and what a seller must build to accept it.
The looot team · · 6 min read
RapidAPI alternatives for AI agents, compared by how you pay
RapidAPI alternatives for AI agents compared on billing and fit: Apify, Bright Data, Composio, x402 marketplaces and a pay-per-call gateway, with dated prices.
Walid Boulanouar · · 7 min read
Try it with the agent you already use
Start your workspace, top up, and paste one prompt into your agent.