x402: The HTTP Payment Protocol That Lets AI Agents Spend Money on the Internet
How Coinbase's x402 protocol turns HTTP 402 status codes into a machine-readable payment layer, processing 165M agent transactions.
The HTTP specification reserved status code 402 for "Payment Required" in 1997. For nearly three decades, no standard existed to make it functional. In May 2025, Coinbase's Developer Platform published the x402 whitepaper, defining an open protocol that turns that dormant status code into a machine-readable payment rail. By April 2026, Coinbase reported 165 million cumulative transactions, roughly $50 million in volume, and 69,000 active AI agents using x402 to pay for resources across the web.
The premise is simple: when an AI agent requests a paid resource, the server responds with HTTP 402 and a structured header describing the price, accepted tokens, and destination address. The agent signs a stablecoin transfer authorization, resubmits the request, and receives the resource after on-chain settlement. No human intervention. No API key negotiation. No billing portal. Just HTTP and cryptographic signatures.
Why HTTP 402 Matters Now
The original HTTP/1.1 specification (RFC 2616) reserved 402 "for future use," anticipating that the web would eventually need native payment semantics. That future arrived with AI agents that autonomously browse, query, and transact on behalf of humans. Unlike human users, agents cannot fill out checkout forms, enter credit card numbers, or navigate OAuth consent screens. They need machine-readable payment flows embedded directly in the HTTP layer.
x402 fills this gap by defining three standardized headers and a three-party settlement architecture. The protocol is open source under the Apache 2.0 license, with reference implementations in TypeScript, Python, and Go available on GitHub. In September 2025, Coinbase and Cloudflare co-founded the x402 Foundation. By April 2026, the Linux Foundation formally adopted the protocol at the MCP Dev Summit, bringing 22 founding members including Visa, Mastercard, Google, Stripe, AWS, and Circle into the governance structure.
Open protocol, not proprietary API: x402 is not a Coinbase product. It is an open standard contributed to the Linux Foundation. Any server can return a 402 response, any wallet can sign a payment authorization, and any facilitator can settle the transaction. The protocol has no gatekeepers.
How an x402 Payment Works
A complete x402 transaction involves three parties: the client (an AI agent with a wallet), the resource server (an API or service behind a paywall), and the facilitator (an independent settlement service that verifies signatures and submits blockchain transactions). The flow proceeds in seven steps.
The Seven-Step Flow
- The agent sends a standard HTTP request to a paid endpoint with no special headers.
- The server responds with HTTP 402 and a
PAYMENT-REQUIREDheader containing base64-encoded JSON: the token contract address, amount in atomic units, blockchain network (using CAIP-2 format), recipient wallet address, accepted payment schemes, and a resource description. - The agent parses the requirements, selects a payment method, and signs a gasless USDC transfer authorization locally using its private key. On EVM chains, this uses the EIP-3009 pattern (
transferWithAuthorization). On Solana, it usesTransferCheckedfor SPL tokens. - The agent resubmits the identical HTTP request with the signed authorization in the
PAYMENT-SIGNATUREheader. - The server forwards the signature to a facilitator's
/verifyendpoint. The server never interacts with the blockchain directly. - The facilitator verifies the cryptographic signature, submits the transfer to the blockchain, pays gas fees (approximately $0.001 on Base), awaits confirmation, and returns a transaction hash.
- The server delivers the resource with HTTP 200 and includes a
PAYMENT-RESPONSEheader containing the settlement confirmation and transaction hash.
The entire sequence completes in seconds. From the agent's perspective, it made two HTTP requests: one that returned a price tag and one that included payment. No SDK integration, no webhook callbacks, no polling for invoice status.
The Three Headers
| Header | Direction | Contents |
|---|---|---|
PAYMENT-REQUIRED | Server → Client | Base64 JSON: resource description, price in atomic units, token contract address, CAIP-2 network ID, recipient address, accepted schemes |
PAYMENT-SIGNATURE | Client → Server | Base64: signed gasless transfer authorization (EIP-3009 on EVM, TransferChecked on Solana) |
PAYMENT-RESPONSE | Server → Client | Base64 JSON: settlement confirmation, blockchain transaction hash, timestamp |
The EIP-3009 Trick: Gasless Stablecoin Transfers
The core cryptographic mechanism enabling x402 on EVM chains is EIP-3009, which defines transferWithAuthorization() on ERC-20 tokens. This function lets a token holder sign an off-chain message authorizing a one-time, recipient-specific transfer. Anyone (in this case, the facilitator) can then submit that signed message to the token contract on-chain.
Circle's USDC contract has supported EIP-3009 since its v2 upgrade, which is why USDC is the dominant settlement asset for x402. The authorization includes six fields: from, to, value, validAfter, validBefore, and a random 32-byte nonce. Each signature is single-use: the on-chain contract tracks consumed nonces, so replay attempts fail deterministically.
This design means the AI agent never needs to hold native gas tokens. It signs a USDC-specific authorization; the facilitator pays gas (fractions of a cent on Layer 2 networks like Base) and earns a small fee for the service. The agent's wallet only needs stablecoin balance to participate in the economy.
Non-custodial by design: Facilitators never take custody of agent funds. They receive a pre-signed, recipient-locked authorization that can only transfer a specific amount to a specific address within a specific time window. A compromised facilitator cannot redirect funds or increase the transfer amount.
The Facilitator Role
Facilitators are the settlement backbone of x402. They expose a simple API with four endpoints: /verify (validate a payment signature without executing it), /settle (execute a verified payment on-chain), /supported (list supported schemes and networks), and /discovery/resources (automatic API discovery, added in V2).
Resource servers delegate all blockchain interaction to facilitators. This separation means a standard web server can monetize its API with x402 by adding a middleware layer and pointing to a facilitator endpoint. The server never manages private keys, submits transactions, or monitors block confirmations. Coinbase operates a reference facilitator, but the architecture is open: any entity can run one.
Adoption Numbers and What They Mean
On April 21, 2026, Coinbase reported the following cumulative figures for x402:
| Metric | Value (April 2026) | Context |
|---|---|---|
| Cumulative transactions | 165 million | Roughly $0.30 average transaction size, reflecting micropayment dominance |
| Cumulative volume | ~$50 million | Settled primarily in USDC on Base |
| Active agents | 69,000 | Agents with at least one x402 transaction in the trailing 30 days |
| Foundation members | 22 (later expanded to 40+) | Including Visa, Mastercard, Google, AWS, Circle, Stripe, Shopify |
These numbers merit context. Independent analyses estimated that approximately half of early x402 activity consisted of testing, gamified usage, and bot farming rather than production commerce. Daily transaction values during Q1 2026 averaged roughly $28,000 across around 131,000 daily transactions, putting the average payment at approximately $0.20. This is consistent with machine-to-machine micropayment patterns: agents paying fractions of a dollar per API call, data query, or compute unit.
By mid-2026, cumulative figures grew to 205 million transactions and $53 million in volume. The trajectory matters more than the absolute numbers: x402 created a net-new payment category that did not exist 18 months earlier.
How x402 Compares to Alternative Protocols
x402 is not the only protocol addressing agentic payments. Google, Stripe, OpenAI, and the Lightning ecosystem each offer different approaches. Understanding the landscape requires examining what layer each protocol operates at.
Protocol Comparison
| Protocol | Created By | Settlement | Primary Use Case | Launched |
|---|---|---|---|---|
| x402 | Coinbase | USDC on Base, Solana, Ethereum | Pay-per-request API monetization | May 2025 |
| AP2 (Agent Payment Protocol) | Google + 60 partners | Rail-agnostic (cards, banks, crypto) | Authorization and intent expression | 2025 |
| ACP (Agentic Commerce Protocol) | OpenAI + Stripe | Fiat via Stripe (cards, bank transfers) | Conversational checkout for e-commerce | September 2025 |
| MPP (Machine Payments Protocol) | Stripe + Tempo | Hybrid: stablecoins + fiat | Session-based streaming micropayments | March 2026 |
| L402 | Lightning Labs | Bitcoin via Lightning Network | High-frequency sub-cent micropayments | 2023 |
Key Architectural Differences
These protocols are largely complementary rather than competing, because they operate at different layers of the payment stack.
Google's AP2 is an authorization layer, not a settlement layer. It defines cryptographically signed "Mandates" (tamper-proof JSON-LD objects) that express purchase intent and spending constraints. AP2 always needs a separate payment rail to move money: x402, MPP, card networks, or bank transfers. Google even published an official A2A-x402 extension showing the two protocols working together.
OpenAI and Stripe's ACP focuses on conversational checkout: an agent negotiating with a merchant through four RESTful endpoints (Create, Update, Complete, Cancel). It uses SharedPaymentTokens that are single-use, time-bound, and amount-restricted. ACP runs entirely on fiat rails through Stripe, making it accessible to traditional merchants but unable to serve crypto-native or permissionless environments.
Stripe and Tempo's MPP takes a session-based approach: agents pre-authorize spending limits upfront, then stream micropayments within sessions without per-transaction on-chain costs. This reduces settlement overhead for high-frequency interactions but introduces session management complexity. MPP supports hybrid settlement across stablecoins and fiat.
L402 (formerly LSAT), created by Lightning Labs, uses the Lightning Network for Bitcoin-denominated micropayments combined with macaroons for authentication. L402 achieves the lowest per-payment latency (milliseconds) and the smallest practical minimum payment (1 satoshi, approximately $0.0007). The tradeoff is Bitcoin price volatility: a stablecoin-denominated protocol like x402 avoids the pricing complexity of quoting API calls in a volatile asset.
Settlement Characteristics
| Feature | x402 | L402 (Lightning) | MPP (Stripe/Tempo) | ACP (OpenAI/Stripe) |
|---|---|---|---|---|
| Denomination | USDC (stable) | BTC (volatile) | Hybrid (stable + fiat) | Fiat only |
| Settlement finality | Seconds (L2 block time) | Milliseconds | Session-batched | Days (card settlement) |
| Minimum practical payment | ~$0.01 | ~$0.0007 (1 sat) | ~$0.001 (streamed) | ~$0.50 (card minimums) |
| Gas/fee paid by | Facilitator | Sender (routing fees) | Platform | Merchant (Stripe fees) |
| KYC requirement | None at protocol level | None | Stripe account required | Stripe account required |
| Permissionless | Yes | Yes | No (Stripe-gated) | No (Stripe-gated) |
Security Considerations for AI Agent Payments
Giving an AI agent a wallet and spending authority introduces risks that traditional payment systems never faced. x402 addresses some at the protocol level but explicitly delegates others to the application layer.
What the Protocol Provides
- EIP-3009 nonce-based replay prevention: each signed authorization uses a random 32-byte nonce tracked on-chain, making replay impossible
- EIP-712 typed data signing: structured, human-readable (and machine-parseable) authorization format
- Time constraint windows:
validAfterandvalidBeforefields limit authorization validity (default 300 seconds) - Recipient-locked transfers: each authorization specifies an exact recipient address and amount, preventing redirection
- On-chain audit trail: every settled payment produces an immutable blockchain transaction
What Must Be Layered On Top
x402 intentionally does not specify spending limits, wallet key management, fraud detection, or compliance controls. These are application-layer concerns that vary by use case. Production deployments should implement:
- Per-agent and per-session spending budgets enforced at the wallet layer
- Recipient allowlists restricting which addresses an agent can pay
- Rate limiting on payment frequency to prevent runaway loops
- Anomalous spending monitoring with circuit breakers
- Scoped signing authority using session keys with limited permissions
Known Attack Vectors
Academic security analyses have identified several attack surfaces specific to agent payment systems. Wallet drain attacks can occur when adversaries manipulate tool outputs that agents act on: a compromised data source could return inflated prices, causing an agent to overpay. The V2 specification's dynamic routing feature, which lets servers specify payment destinations in the 402 response, introduces recipient manipulation risk if the agent does not validate destinations against an allowlist. Supply chain risks also emerge from modular SDK plugins that agents load to interact with different facilitators.
Defense in depth: The safest production pattern combines protocol-level protections (replay prevention, time bounds, recipient locking) with application-level controls (spending budgets, allowlists, rate limits) and smart wallet constraints (session keys with scoped permissions and expiration). No single layer is sufficient.
The V2 Specification
The x402 V2 specification, dated December 2025 and publicly launched in June 2026, introduced several refinements over the initial protocol.
- CAIP-2 network identifiers for chain-agnostic addressing (e.g.,
eip155:8453for Base mainnet,solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpfor Solana) - Modernized header names dropping the deprecated
X-prefix convention from V1 - Discovery endpoint (
/discovery/resources) enabling automated API cataloging by agents - Extension framework for adding custom metadata, compliance fields, or alternative payment schemes without breaking the core spec
- Compatibility path for legacy payment rails (ACH, SEPA, card networks) via CAIP standards, though crypto settlement remains dominant
V2 also formalized the "exact" payment scheme (fixed-amount transfers) and laid groundwork for an "upto" scheme for variable-consumption resources where the final price is determined after delivery.
What This Means for Bitcoin Settlement
x402 currently settles primarily in USDC on Base and Solana. But the protocol is settlement-agnostic by design: any blockchain that supports signature-authorized token transfers can serve as a settlement layer. This opens a path for Bitcoin Layer 2 networks.
Spark, for example, supports native token issuance including stablecoins like USDB. Its instant settlement, sub-cent transaction costs, and self-custodial architecture align with the properties x402 facilitators need: fast finality for responsive API interactions, low fees to make micropayments economical, and cryptographic transfer authorization compatible with non-custodial wallet designs.
An x402 facilitator settling on a Bitcoin L2 would give AI agents access to Bitcoin-native infrastructure without the price volatility of paying in BTC. Agents could hold dollar-denominated stablecoins on Bitcoin rails, combining the settlement assurance of the Bitcoin network with the pricing stability that autonomous spending requires. The payment channel overhead that limits L402's accessibility would be avoided entirely.
The Foundation and Governance
The x402 Foundation's 22 founding members represent a cross-section of payments infrastructure: card networks (Visa, Mastercard, American Express), payment processors (Adyen, Fiserv, Worldpay, PPRO), cloud platforms (AWS, Cloudflare), crypto infrastructure (Circle, Base, Polygon Labs, Solana Foundation, thirdweb), technology companies (Google, Microsoft, Shopify), and fintech platforms (Stripe, KakaoPay). The foundation has since expanded to over 40 members.
Cloudflare built native x402 support into Cloudflare Workers, enabling any edge-deployed application to add pay-per-request monetization with minimal code changes. This infrastructure-level integration reduces the barrier for resource servers: a developer can add x402 paywall middleware in a few lines rather than building custom payment gateway integrations.
Limitations and Open Questions
Volume Quality
The headline adoption numbers include significant non-commercial activity. Independent analyses estimated that roughly half of early x402 transactions consisted of testing, gamified usage, and bot farming. The protocol's permissionless nature, a strength for adoption, also means there is no gatekeeper filtering out low-quality transactions from reported metrics.
Fiat Ramp Dependency
Agents need stablecoin balances to pay via x402. Acquiring those stablecoins still requires fiat on-ramps with KYC, creating a friction point that the protocol itself does not solve. The "permissionless" label applies to the payment flow, not necessarily to the wallet funding step.
Dispute Resolution
x402 has no built-in chargeback or dispute resolution mechanism. If a resource server takes payment but delivers garbage data, the agent has no recourse at the protocol level. Reputation systems, escrow layers, or third-party arbitration would need to be built on top.
Price Discovery
The protocol assumes the server sets a price and the agent decides whether to pay. There is no negotiation mechanism, no auction, and no way for agents to comparison-shop across providers within the protocol itself. Market-making and price aggregation remain unsolved at the standard level.
Building with Agent Payments
For developers building agentic payment infrastructure, the x402 ecosystem offers multiple integration paths. The reference implementation includes server middleware for Node.js and Python, client libraries for wallet integration, and facilitator SDKs for settlement providers. The Spark SDK provides the building blocks for Bitcoin L2 settlement: instant transfers, stablecoin support, and self-custodial wallet primitives that could underpin a next-generation x402 facilitator.
The broader trend is clear: AI agents need programmable money, and programmable money needs machine-readable protocols. Whether settlement happens on Base, Solana, or a Bitcoin Layer 2 like Spark, the HTTP layer is converging on a standard way for software to pay for resources. x402 is the most advanced attempt to define that standard, and its adoption by the Linux Foundation signals that the internet's payment layer is finally being built.
This article is for educational purposes only. It does not constitute financial or investment advice. Bitcoin and Layer 2 protocols involve technical and financial risk. Always do your own research and understand the tradeoffs before using any protocol.

