The open standard enabling autonomous AI agents to pay for API access using cryptocurrency and stablecoins.
The x402 Protocol is an open payment standard built on the HTTP 402 "Payment Required" status code. It enables AI agents to autonomously pay for API access using cryptocurrencies and stablecoins, primarily USDC. Developed by the Coinbase Development Platform team and now maintained by the x402 Foundation, this protocol represents a fundamental shift in how autonomous systems can access premium services online.
This is one of those topics where surface-level understanding is dangerous. We've seen traders lose significant capital from misconceptions covered in this guide.
At its core, x402 solves a critical problem: how can an AI agent, operating without a credit card or traditional financial institution, pay for computational resources? Before x402, agents either relied on human operators to manage payments, or APIs had no payment mechanism beyond closed ecosystems. x402 introduces a standardized, cryptographically secure way for agents to settle these transactions on-chain.
HTTP 402 "Payment Required" is a reserved status code that has existed in the HTTP specification since 1997 but was rarely used until x402 gave it a practical, standardized implementation. When a server responds with 402, it's telling the client: "I need payment before continuing."
The protocol is intentionally lightweight and protocol-agnostic. It doesn't prescribe which blockchain to use, which token to accept, or which payment method is best. Instead, x402 provides a standardized interface that APIs and AI agents can implement, while the underlying details remain flexible. This design has enabled rapid adoption across multiple blockchain networks and by major companies including Coinbase, Stripe, and Cloudflare.
The x402 payment architecture consists of four key components working together in a coordinated flow. Understanding this architecture is essential to implementing x402 in your applications.
Here's the step-by-step flow of an x402 payment:
In practice, the client often submits its payment transaction to the blockchain before contacting the resource server. This way, by the time the server responds with 402 and the client resubmits, the transaction may already be confirmed on-chain, enabling faster verification.
x402's design makes it particularly powerful for AI agents and MCP (Model Context Protocol) servers. These systems often need to access external APIs, computational resources, and specialized services. Before x402, monetizing MCP servers or having agents pay for services required complex integrations or manual intervention.
An AI agent operating in the DeFi space might use x402 like this:
This flow is completely autonomous. No human intervention is required. The agent evaluates the cost-benefit of the API call, manages its balance sheet, and settles payment on-chain—all programmatically.
MCP (Model Context Protocol) servers provide specialized capabilities to AI systems. With x402, MCP server developers can monetize their work:
Examples of monetizable MCP services include: advanced data analysis, code generation, specialized knowledge lookups, real-time market data, GPU-accelerated computations, and access to proprietary models.
Learn more about AI in DeFi →x402 supports multiple blockchain networks, with adoption leaders being:
x402 uses CAIP-2 network identifiers to standardize how networks are referenced in payment requests. This ensures that when a resource server specifies "eip155:8453" (Base), all clients understand exactly which chain and which payment contract to use.
CAIP-2 (Chain Agnostic Improvement Proposal 2) is a standard for identifying blockchain networks in a chain-agnostic way. "eip155:8453" means EVM chain (eip155) with chain ID 8453 (Base). This standard allows protocols to be truly multi-chain from the start.
USDC (USD Coin) is the primary payment token for x402:
The protocol can technically support other tokens (USDT, DAI, ETH, etc.), but USDC has become the de facto standard due to Coinbase's backing and Circle's guarantees.
Zero protocol fees. x402 itself charges nothing. The ecosystem handles costs as follows:
At ~$600M annualized volume across all networks, x402 has moved meaningful transaction value without extracting protocol fees—a feature that directly benefits the ecosystem.
Learn more about Base Layer 2 →On April 2, 2026, the x402 Foundation was formally established to guide the protocol's evolution and ensure it remains an open, neutral standard. The foundation includes:
Stripe integrated x402 payments specifically for AI agents on Base. This integration enables:
Google developed their Agent Payments Protocol (AP2) which incorporated concepts from x402, particularly the header-based payment negotiation pattern. While AP2 is a separate protocol, the two can interoperate:
Coinbase operates a hosted facilitator service with the following tiers:
Resource server operators who want full independence can self-host a facilitator server. The facilitator is stateless and can be deployed anywhere, making it highly available and resilient.
Learn more about stablecoins →Several competing standards exist for agent payments. Here's how x402 compares:
| Feature | x402 Protocol | Google AP2 | Traditional API Billing (Stripe) | Lightning Network |
|---|---|---|---|---|
| Settlement Layer | Blockchain (Base, Solana, EVM) | Multiple (flexible) | Traditional Banking | Bitcoin Lightning |
| Primary Token | USDC Stablecoin | Any (flexible) | USD/Credit Card | Bitcoin |
| Transaction Speed | 2-6 seconds (Base/Solana) | Variable | 1-3 days | < 1 second |
| Per-Transaction Cost | $0.00005-0.50 | Variable | 2-3% + $0.30 | < $0.01 |
| Protocol Fees | Zero | Zero | 2-3% | < 0.1% |
| Autonomous Agents | ✓ Native support | ✓ Native support | ✗ Requires human auth | ✓ With keysend |
| Maturity | Foundation formed April 2026 | Pre-release | Mature (20+ years) | Established (since 2015) |
| Best Use Case | API payments for AI agents, MCP servers | Google Cloud ecosystem | Traditional SaaS subscriptions | Micropayments, off-chain scalability |
x402 vs Google AP2: Both are designed for the same problem (agent payments) and are largely compatible. x402 has an 18-month head start and broader ecosystem support. Google AP2 benefits from Google Cloud's distribution but is less mature.
x402 vs Traditional Billing (Stripe): Stripe is proven, familiar, and handles 99%+ of online payments. However, it requires human authentication, takes days to settle, and isn't designed for autonomous agents. x402 is built for autonomous operations and instant settlement.
x402 vs Lightning Network: Lightning is extremely fast and cheap but is tied to Bitcoin. x402 supports multiple networks and stablecoins, making it more flexible for diverse agents and business models. Lightning excels at payments but lacks the protocol infrastructure x402 provides.
The best choice depends on your use case. For AI agents paying for APIs in diverse ecosystems, x402 is optimal. For traditional SaaS, Stripe remains best. For Bitcoin-centric applications, Lightning is ideal.
Learn more about PayFi →The x402 Protocol is an open payment standard built on the HTTP 402 "Payment Required" status code, enabling AI agents to autonomously pay for API access using cryptocurrencies and stablecoins like USDC. It was developed by Coinbase and is now maintained by the x402 Foundation with support from the Linux Foundation and Cloudflare.
The x402 payment flow has four steps: (1) Client sends request to resource server, (2) Server responds with HTTP 402 and payment requirements, (3) Client creates cryptographic payment payload and sends with PAYMENT-SIGNATURE header, (4) Facilitator server verifies payment on-chain and returns 200 OK response, granting access.
x402 supports Base (with 119M+ transactions and $35M+ value settled), Solana (35M+ transactions), and any EVM-compatible chain including Ethereum, Polygon, Arbitrum, and Optimism. It uses CAIP-2 network identifiers for multi-network support.
The x402 Foundation, launched on April 2, 2026, maintains the protocol with support from founding members including Coinbase (original developers), Cloudflare, the Linux Foundation, Stripe, and major blockchain networks.
The x402 protocol itself has zero protocol fees. Coinbase provides a free hosted facilitator with a free tier of 1,000 transactions per month. Blockchain network fees apply (ranging from $0.00005 on Solana to $0.50 on Base). Self-hosting a facilitator eliminates facilitation costs entirely.
Yes. x402 is specifically designed for AI agents and MCP (Model Context Protocol) servers to monetize their services. Servers can specify payment requirements in responses, and AI agents can automatically fulfill them, enabling seamless service monetization without custom billing infrastructure.
While AP2 is a separate protocol, they share similar design principles (HTTP-based, header-driven payment negotiation). Cross-compatible agents can support both standards, though they are not directly interoperable. Choosing one depends on your ecosystem alignment—x402 for broader crypto adoption, AP2 for Google Cloud integration.
If a blockchain transaction fails to confirm, the agent will need to resubmit it. If the amount is insufficient due to network fee spikes, the agent should handle this gracefully with retry logic and increased fee estimates. The facilitator will only grant access after verifying confirmed on-chain transactions.
Technically yes, but USDC is the de facto standard. Facilitators and resource servers can configure any ERC-20 token on EVM chains or any SPL token on Solana. However, USDC's stability and liquidity make it the recommended choice for AI payments.
Start with Coinbase's developer documentation and SDKs. For APIs, implement the 402 response with payment requirements. For agents, integrate a crypto wallet and implement the PaymentPayload signing flow. Begin with the free facilitator tier to test before moving to production.