What Is x402? How AI Agents Pay for APIs With HTTP 402 and USDC

What is x402? It is an open payment standard that lets an app or AI agent pay for an API or web page inside the web request itself. The server replies 402 Payment Required with a price, the agent signs a USDC payment, and the data comes back. No account or API key.

Last updated December 3, 2026. Every fact below was checked today against the official x402 documentation and the Coinbase, Cloudflare and Solana developer docs listed under Sources. x402 is changing fast, so check again before you build on it. This article is for education only and is not financial advice.

What is x402, in plain English?

x402 is a set of rules that lets any website or API charge for access directly over HTTP, the protocol your browser already uses, “without accounts, sessions, or credential management” (x402 docs). It is free to use under the Apache-2.0 open-source license, and the code is public on GitHub.

Payments usually move in USDC, a dollar stablecoin issued by Circle. If you are new to stablecoins, our side-by-side look at USDC vs USDT explains what backs each coin and who can freeze it. The standard was created by the Coinbase Developer Platform team and launched in May 2025, according to x402’s own V2 announcement.

Where the name comes from

Every web response carries a status code, like 404 Not Found. Code 402 means Payment Required, and the HTTP standard has listed it as “reserved for future use” for decades (RFC 7231). x402 finally gives that code a job: it tells the client that payment is required, how much, in which token and to which address (x402 docs: HTTP 402).

Why AI agents need a new way to pay

Using a paid API usually means creating an account, adding a card and copying an API key into your software. That is awkward for an AI agent that finds a useful data source halfway through a task. Cloudflare’s docs note that traditional onboarding requires all three before an agent can pay (Cloudflare).

With x402, the agent needs only a crypto wallet. It can pay for one request, get its answer and move on; the x402 FAQ’s pricing example is $0.001 per request. Listed uses include pay-per-call APIs, paywalls for articles and tools sold per call.

How x402 works in 5 steps

Here is the full loop, using version 2 header names:

  1. The agent asks. It sends a normal web request, such as GET /weather, to a paid API.
  2. The server names its price. It answers 402 Payment Required with a PAYMENT-REQUIRED header that lists the price, the accepted token, the network and the seller’s wallet address.
  3. The agent signs a payment. Its wallet signs a payment payload for that amount, and the agent sends the same request again with a PAYMENT-SIGNATURE header.
  4. The payment is checked and settled. The server verifies the signature and settles the payment onchain, either by itself or through a facilitator’s /verify and /settle services.
  5. The data comes back. The server returns the resource with a PAYMENT-RESPONSE header confirming settlement.
Diagram of how x402 works in five steps: an AI agent requests an API, the server replies 402 Payment Required with a PAYMENT-REQUIRED header, the agent signs a USDC payment and retries with PAYMENT-SIGNATURE, a facilitator verifies and settles it onchain, and the server returns the data with PAYMENT-RESPONSE
The x402 payment loop in five steps (V2 header names). Cryptolix graphic, December 2026.

Because the buyer signs every payment, a middleman cannot quietly change it. The x402 FAQ says a facilitator that tampered with a transaction would fail the signature checks and could not settle it (x402 FAQ). It also says payments settle in about one second.

What a facilitator does

A facilitator is an optional service that handles the blockchain work for the seller. The x402 docs say it does not hold funds or act as a custodian; it verifies signed payments and submits them onchain (x402 docs: Facilitator). Anyone can run one. Coinbase’s CDP Facilitator, which adds sanctions screening, is free for the first 1,000 onchain transactions each month, then $0.001 per transaction, and Coinbase says it has processed more than 100 million transactions (Coinbase docs).

x402 V1 vs V2: what changed

x402 V2 was announced on December 11, 2025 (x402.org). It moved all payment data into HTTP headers and added plug-in “extensions.” The migration guide lists the main differences (migration guide):

V1V2
Header the client pays withX-PAYMENTPAYMENT-SIGNATURE
Settlement header from the serverX-PAYMENT-RESPONSEPAYMENT-RESPONSE
Payment request from the serverIn the response bodyPAYMENT-REQUIRED header
Network namesPlain strings such as base-sepoliaCAIP-2 IDs such as eip155:84532
Version fieldx402Version: 1x402Version: 2
Source: x402 migration guide and V2 announcement, checked December 3, 2026.

The reference SDKs still accept V1, but Solana’s guide says new integrations should not use V1 fields.

x402 vs API keys vs card checkout

x402API keys and subscriptionsCard checkout
Sign-up neededNone; a wallet is enoughAccount, payment method and API keyCard form for each purchase or a saved card
Who can payPeople, apps and AI agents with a walletWhoever set up the accountMainly people
How you payPer request, in stablecoins such as USDCMonthly plan, prepaid credits or usage billPer purchase, in regular money
Undoing a paymentFinal once settled; the seller can send a refundDepends on the providerCard refunds and disputes
Based on the x402 FAQ, Coinbase’s x402 overview and Cloudflare’s Agents docs, checked December 3, 2026.
Comparison graphic of x402 versus API keys and subscriptions versus card checkout: x402 needs only a wallet and pays per request in stablecoins, API keys need an account, payment method and key, and card checkout needs a person to fill in a payment form
x402 vs API keys vs card checkout, based on the x402, Coinbase and Cloudflare docs checked December 3, 2026.

In short, x402 suits small, automatic payments between pieces of software, not a family shopping online with a credit card.

Which networks, coins and payment types work?

At the protocol level x402 works with any EVM chain plus Solana, Stellar, Aptos, Sui and others (x402 docs: Networks). In practice, the FAQ’s main table lists Base and Solana mainnets, and Coinbase’s facilitator also covers Polygon, Arbitrum, Monad and World.

The standard also offers several payment schemes (x402 docs: Schemes):

  • exact: a fixed price per request, the most common choice.
  • upto: the buyer approves a maximum and pays only for actual usage, such as AI tokens used.
  • batch-settlement: the buyer deposits once into an onchain escrow contract (see how smart contracts work), then pays per request with off-chain vouchers that are settled in batches.
  • auth-capture: funds are held in escrow and then captured, voided or refunded after the service is delivered.

x402 does not natively cash out to a bank, though the FAQ says gateways can add that step.

Who is behind x402?

Coinbase contributed x402 to the Linux Foundation, which announced the operational launch of the x402 Foundation on July 14, 2026. Premier members include Amazon Web Services, American Express, Circle, Cloudflare, Google, Mastercard, Shopify, Stripe and Visa (Linux Foundation announcement). On October 1, 2026, payments veteran Michael Hursta was named executive director of a foundation with more than 50 members (x402.org).

Cloudflare’s Agents SDK can charge for HTTP content and AI tools with x402, and its client can ask a human to approve payments (Cloudflare docs). Solana publishes its own x402 V2 guide (Solana docs).

Costs and risks to know

  • Fees: the standard has “0 fees built in,” but network costs and any facilitator fees still apply.
  • Payments are final: an exact payment cannot be pulled back. Refunds depend on the seller.
  • Runaway spending: an agent with a funded wallet can spend it. Solana’s guide says production agents should get per-payment and total spending limits, not a raw private key.
  • Wrong network: testnets use test money; real payments need real USDC on the right mainnet.
  • Fake “x402 tokens”: x402 is a standard, not a coin. Treat any token sold under the name with suspicion.
  • Rules: USDC is a payment stablecoin, so the US GENIUS Act, which takes effect January 18, 2027 (OCC), applies to its issuer. Our plain-English guide to the GENIUS Act explains what it means for holders.

How to try x402 or fund an agent wallet

Disclosure: Some links in this article are, or may become, affiliate links. If you sign up or buy through them, Cryptolix may earn a commission at no extra cost to you. This never changes what we recommend. See our Affiliate Disclosure. This article is for education only and is not financial advice.

If you build software, the Coinbase Developer Platform x402 docs have quickstarts for buyers and sellers, and the official x402 libraries come in TypeScript, Python and Go. Start on a testnet such as Base Sepolia or Solana Devnet with free test USDC before any real money moves.

To give an agent real money, buy USDC on a US exchange such as Coinbase or Kraken and send only a small budget to the agent’s wallet. Keep the rest of your savings on a hardware wallet such as Ledger or Trezor. Want to receive USDC from people instead? Our guide on how to accept USDC payments as a merchant compares Stripe, Coinbase Business and Shopify.

Video: x402 explained by its creator

Erik Reppel, the Coinbase engineer who wrote x402, walks through the 402 status code, the payment flow and live demos. It dates from October 2025, before V2 renamed the headers.

Checklist: before you let an agent pay with x402

  • ☐ The agent uses its own wallet, separate from my savings.
  • ☐ That wallet holds only a small USDC budget I can afford to lose.
  • ☐ Per-payment and total spending limits are set in code.
  • ☐ I tested the whole flow on a testnet first.
  • ☐ The network and token match what the seller asks for.
  • ☐ I know which facilitator settles payments and what it charges.
  • ☐ I keep records of what the agent paid, and to whom.
Checklist graphic for letting an AI agent pay with x402: use a separate wallet with a small USDC budget, set per-payment and total spending limits, test on a testnet first, match the network, check the facilitator, and keep savings in a hardware wallet
Run through this before you let any agent spend. Education only, not financial advice.

This explainer is part of our series on stablecoin payments and AI agents that pay; browse the Crypto Payments and AI Agents category for the rest as it is published.

Frequently asked questions

Is x402 a cryptocurrency or a token?

No. x402 is a payment standard, not a coin, and there is no x402 token to buy. It describes how a server asks for payment over HTTP and how a client pays, usually in a stablecoin such as USDC on Base or Solana.

Do I need Coinbase to use x402?

No. The x402 docs say it is an open Apache-2.0 standard and you don’t need any Coinbase products. Coinbase created it and runs a facilitator, but anyone can run one, and the x402 Foundation at the Linux Foundation now stewards it.

How much does an x402 payment cost?

The standard has no built-in fee. The buyer pays the price the seller sets. Sellers may pay network or facilitator costs: Coinbase’s facilitator is free for the first 1,000 onchain transactions a month, then $0.001 each.

Can an x402 payment be refunded?

A standard exact payment is a push payment and is final once settled, so a refund means the seller sends money back. Newer schemes add options: auth-capture holds funds in escrow, and batch-settlement defines refunds from its escrow channel.

What changed in x402 V2?

V2, announced December 11, 2025, renamed the headers (X-PAYMENT became PAYMENT-SIGNATURE), moved payment data into headers and adopted standard CAIP-2 network IDs, such as eip155:8453 for Base. The reference SDKs stay backward-compatible with V1.

Sources

Share this...