Setup

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.

CodeRFC meaningWhat the client does
401 Unauthorizedthe 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 Forbiddenthe server "understood the request but refuses to fulfill it"stop, retrying will not help
429 Too Many Requeststhe 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:

  1. Read the response headers and body. The server's own format says what it wants.
  2. 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.
  3. 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.
  4. 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:

  1. The agent sends a normal request, for example `GET /company?domain=stripe.com`.
  2. 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.
  3. The agent picks one option and signs a payment payload with its wallet.
  4. The agent sends the same request again with a `PAYMENT-SIGNATURE` header that carries the signed payload.
  5. The server checks the payload, on its own or through a facilitator's `/verify` endpoint, then does the work.
  6. 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.

x402Stripe MPPPrepaid balance
Account with the sellerNoneNoneOne workspace
How the buyer paysTokens from a wallet, usually stablecoinsStablecoins, cards through Stripe, Lightning and other methodsCard on a hosted checkout, paid by a person
When money movesEach call, or batched with batch settlementEach call, or in a sessionOnce per top-up
Who approves a paymentNobody, the wallet signsNobody per call; a card token carries limits set in advanceA person, once per top-up
What the agent holdsA wallet keyA wallet key or a scoped card tokenAn API key
Getting money backThe `exact` scheme is irreversible, so the seller has to send a new transferNo refund protocol; the seller pays a charge back itself, and unclaimed session funds return to the buyerA miss is free unless its provider bills for it
Safe retriesThe payment-identifier extensionIdempotency is part of the protocolAn idempotency key on each call
Accepted by looot todayNoNoYes

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

Check how an API wants to be paid
Use looot to search for an API that returns company data from a domain, and tell me how it bills. First set up https://looot.ai/skill.md. Searching is free. If a paid run is needed and the balance is too low, call top_up and show me the Checkout link instead of paying. If any call returns HTTP 402, tell me what the body says and stop.

For x402 marketplaces next to other API marketplaces, see RapidAPI alternatives for AI agents.

Questions

It is an HTTP status code a server sends when it wants payment before it answers. RFC 9110 says it is "reserved for future use" and defines no format, so each API decides what its 402 means.

Yes, it is a 4xx client error, but not a broken request. It means the request is fine and payment is missing. Retrying without paying or topping up returns the same 402.

A 402 says payment would unlock the request. A 403 says the server refuses it, and paying will not change that.

x402 is an open protocol for paying inside an HTTP request. A server answers 402 with its price, the client signs a stablecoin payment and retries, and a facilitator settles it.

The server sends `PAYMENT-REQUIRED` with the 402. The client retries with `PAYMENT-SIGNATURE`. The server confirms with `PAYMENT-RESPONSE`. Each holds base64-encoded JSON.

No. x402.org says it needs "no accounts or personal information". The agent needs a funded wallet that can sign.

Coinbase's facilitator is free for the first 1,000 onchain transactions a month, then $0.001 each, paid by the seller ([CDP facilitator](https://docs.cdp.coinbase.com/x402/seller/facilitator), read 2026-11-16). Verification is free.

Not yet, looot runs on a prepaid balance today. If you want to see x402 supported, please send us feedback.

Use a protocol when an agent must pay sellers it has no account with, x402 for stablecoins and MPP when you need cards or the seller is on Stripe. Use a prepaid balance when an agent calls known APIs for a company that pays by card.

No. Both use HTTP 402. x402 moves tokens and has no native card support. MPP, from Stripe and Tempo, also carries card payments and can run x402 flows through its SDK.
ShareXLinkedInEmail

Try it with the agent you already use

Start your workspace, top up, and paste one prompt into your agent.