Skip to main content

What Is x402? The HTTP 402 Payment Protocol for AI Agents

· 9 min read
OrcaRail
Crypto payment rails for web2 apps

x402 is an open payment protocol that puts payments inside normal web requests. When a client asks for a paid resource, the server answers with HTTP status 402 (Payment Required) and a price. The client, often an AI agent, signs a stablecoin payment, usually in USDC, and sends the same request again with the payment attached. There is no account to create, no API key to manage and no checkout page.

This guide explains how x402 works step by step, the terms you will see in the spec, what changed in x402 V2, which networks it runs on, what it costs, and when a regular crypto checkout is the better fit. OrcaRail does not offer x402 payments today, and the end of this post explains what it offers instead.

What is x402​

x402 describes itself as "an open, neutral standard for internet-native payments" (x402.org). Coinbase's x402 documentation puts it more concretely: x402 "lets a server charge for a resource through the same request used to fetch it" (x402 FAQ).

The name comes from HTTP status code 402, Payment Required. The HTTP standard defines the code but leaves it unused: "The 402 (Payment Required) status code is reserved for future use" (RFC 9110). x402 gives that code a real job.

The protocol facts in this post come from x402.org, the x402 Foundation repository and Coinbase's x402 FAQ, checked on 12 November 2026.

How x402 works, step by step​

The repository describes the typical flow. In short:

  1. The client asks for a resource, for example GET /api/report.
  2. The server answers 402 Payment Required. A PAYMENT-REQUIRED header lists the payment options it accepts: scheme, network, token, amount and the address to pay.
  3. The client picks one option and signs a payment with its wallet.
  4. The client sends the same request again, with the signed payment in a PAYMENT-SIGNATURE header.
  5. The server verifies the payment, on its own or by calling a facilitator's /verify endpoint.
  6. The server does the work and settles the payment on-chain, on its own or through the facilitator's /settle endpoint.
  7. The server returns 200 OK with the resource and a PAYMENT-RESPONSE header that holds the settlement result.

If the client already knows the price, it can skip the first round trip and pay with its first request.

On the wire, it looks like this. Each header value is base64-encoded JSON:

GET /api/report HTTP/1.1
Host: api.example.com

HTTP/1.1 402 Payment Required
PAYMENT-REQUIRED: <price, network, token and pay-to address>

GET /api/report HTTP/1.1
Host: api.example.com
PAYMENT-SIGNATURE: <the signed payment>

HTTP/1.1 200 OK
PAYMENT-RESPONSE: <settlement result>

x402 terms: client, server, facilitator and scheme​

TermWhat it means
ClientThe app, script or AI agent that pays. It needs a wallet with a token balance, usually USDC.
Resource serverThe API or website that charges. It answers unpaid requests with 402 and a price.
Facilitator"A server that facilitates verification and execution of payments for one or many networks." It is optional: a resource server can verify and settle payments itself.
SchemeHow the payment works. The repository lists exact (a set amount, such as $1 to read an article), upto (the client allows a maximum, and the seller settles the actual usage up to that cap) and batch-settlement (EVM only: many small charges settled on-chain in batches).

What changed in x402 V2​

The V2 announcement and Coinbase's FAQ list these changes:

  • New headers. PAYMENT-REQUIRED, PAYMENT-SIGNATURE and PAYMENT-RESPONSE replace V1's X-PAYMENT and X-PAYMENT-RESPONSE. All payment data now travels in headers; V1 sent the payment requirements in the response body.
  • Standard network names. Networks use CAIP-2 IDs. Base is eip155:8453, and a Solana network is solana: followed by its genesis hash.
  • Sessions. V2 "adds wallet-based identity (skip repaying on every call)."
  • Extensions and plugins. New features ship as extensions instead of changes to the spec. One example is Discovery, which lets x402 services publish metadata that facilitators can index. In the SDKs, chains, tokens and schemes are plugins.
  • Backward compatibility. The reference SDKs are "fully backward-compatible with V1."

Which networks and tokens x402 supports​

x402.org says the protocol "is blockchain-agnostic and supports all EVM-compatible chains, Solana, and more," and that "stablecoin payments are the primary use case." It is also designed to extend to traditional payment methods.

What works in practice depends on the facilitator you use. Coinbase's hosted facilitator, for example, settles on Base, Polygon, Arbitrum, Monad, World and Solana mainnets (FAQ). It accepts ERC-20 tokens on those EVM networks and SPL or Token-2022 tokens on Solana. Tokens that implement EIP-3009, such as USDC and EURC, settle without the buyer holding a gas token. Other ERC-20 tokens go through Permit2, which can add a one-time approval that the buyer pays gas for.

What x402 costs​

  • Protocol fee: none. x402.org lists "Zero protocol fees" and says the protocol is "free for the customer and the merchant—just pay nominal payment network fees."
  • Network fee. Each settlement is a blockchain transaction, and someone pays its gas. Coinbase's facilitator pays it and covers it with its per-transaction price.
  • Facilitator fee. Each facilitator sets its own. Coinbase's facilitator makes the first 1,000 transactions each month free, then charges $0.001 per transaction. Verification is free.

x402 vs a crypto payment gateway​

x402Crypto payment gateway
Who paysSoftware: an AI agent, a script or an app with a walletPeople, on a payment page
When payment happensInside the HTTP request, per callAt checkout, per order or billing period
PricingPer request: an exact amount, or up to a capOrders, invoices and subscriptions
How the payer paysThe client signs in code, with no pageThe customer pays from a wallet on a hosted page
How your backend learns about itThe PAYMENT-RESPONSE header of the same requestWebhooks and a dashboard
OrcaRail todayNot offeredYes

The two solve different problems. x402 suits APIs, data and content that software buys on its own, one request at a time. A payment gateway suits selling to people: a product page, an invoice or a monthly plan.

Who x402 is for​

  • API and data providers that want to charge per call without accounts or API keys.
  • AI agent builders whose agents must pay for tools, data or content on their own.
  • Publishers that want to charge per article or per request instead of a subscription.

If your customers are people buying products, plans or services, a hosted checkout is still the simpler path. People expect a payment page, a receipt and a way to manage their subscription.

How to start with x402​

  1. Read the spec in the x402 Foundation repository and pick a scheme. exact is the simplest.
  2. Install an SDK. The README lists TypeScript packages under @x402/, a Python package (pip install x402) and a Go module.
  3. Test on a testnet first, for example Base Sepolia (eip155:84532). Our testnet faucets guide lists where to get free test USDC.
  4. Choose a facilitator, or verify and settle payments in your own server.
  5. Move to mainnet once test payments settle as expected, with a wallet you control as the pay-to address.

What OrcaRail offers instead​

OrcaRail does not support x402 today. It is a crypto payment gateway for selling to people. Customers pay on a hosted checkout (payment intents), through a payment link, or with a subscription, in USDC, USDT or other tokens on EVM chains, Solana and Bitcoin. Each payment is forwarded to your own wallets. OrcaRail charges 0.5% per completed transaction, and the first 100 transactions are free (pricing).

AI agents can still run those payments for you. The OrcaRail MCP server lets Claude Code, Cursor and Codex create checkouts and subscriptions from a prompt; AI agent payments shows how to connect it in a sandbox. To build an integration with an AI coding agent, give it llms.txt and see Build with AI.

Want USDC from customers today? See how to accept USDC payments.

FAQ​

What does x402 stand for?​

It is named after HTTP status code 402, Payment Required, which the HTTP standard reserves for future use. x402 is a protocol, not a coin: payments move existing tokens, mostly stablecoins such as USDC.

Is x402 free to use?​

The protocol itself has no fees. You still pay network fees, and a facilitator may charge for verifying and settling payments. Coinbase's facilitator, for example, makes the first 1,000 transactions each month free and then charges $0.001 per transaction (checked on 12 November 2026).

Does x402 work on Solana?​

Yes. x402.org lists EVM chains and Solana, and Coinbase's facilitator settles on Solana mainnet. In V2, a Solana network is named solana: followed by its genesis hash.

Where is the x402 GitHub repository?​

At github.com/x402-foundation/x402, under the Apache-2.0 license. The older coinbase/x402 repository is now a development fork, and its issues and pull requests moved to the x402 Foundation repository.

Does OrcaRail support x402?​

Not today. OrcaRail offers hosted checkouts, payment links and subscriptions for people who pay in USDC, USDT and other tokens, and an MCP server that lets AI agents create those payments for you.


Start in the sandbox · AI agent payments · Pricing