x402 is an open-source payments protocol built on HTTP that enables digital payments on the internet. It leverages the long-reserved HTTP 402 "Payment Required" status code to create a standardized way for servers to request payment for resources and for clients to fulfill those payments programmatically.
The protocol addresses fundamental problems with traditional internet payments: credit cards require high friction, impose steep minimums, and don't align with the programmatic nature of digital services. x402 enables true micropayments with settlements as fast as 200 milliseconds on blockchain rollups.
The x402 protocol involves three main actors working together to enable seamless payments:
The payment flow works as follows:
Facilitator servers are a critical component of the x402 ecosystem. They act as trusted intermediaries that handle the blockchain-specific complexities of payment verification and settlement.
Facilitators expose three key endpoints:
By abstracting blockchain complexity, facilitators enable resource servers to accept payments without deep blockchain expertise. They ensure payments are valid, prevent double-spending, and handle the technical details of on-chain settlement across multiple blockchain networks.
x402 enables new business models and use cases that were previously impossible or impractical:
x402 is developed by Coinbase and released as open-source software under the Apache 2.0 license. The project has gained significant traction with over 2,500 GitHub stars, 380 forks, and 65+ contributors from the developer community.
The protocol is guided by five core principles:
The project is actively maintained with comprehensive documentation, examples in multiple programming languages (TypeScript, Python, Java, Go), and a growing ecosystem of integrations and services.
The x402 ecosystem has grown to include various tokens and projects building on the protocol. The ecosystem has a combined market cap of approximately $50.7 million and includes tokens across multiple blockchains including Base, Solana, and others.
| Token | Symbol | Blockchain | Market Cap | Description |
|---|---|---|---|---|
| Daydreams | DREAMS | Solana | $24.08M | Generative agent library for playing anything on-chain. Provides x402-enabled LLM inference for agents and applications. |
| SANTA by Virtuals | SANTA | Base | $3.3M | Offers dynamic learning, teaching agents to adapt to new services through example-driven configurations. |
| Heurist | HEU | Base | N/A | Full-stack infrastructure for the AI economy. Provides crypto skills for AI agents with MCP and x402 support. |
For live prices and a complete list of x402 ecosystem tokens, visit CoinGecko's x402 Ecosystem page.
Implementing x402 in your application is straightforward. For a basic TypeScript server, it's as simple as adding a single line of middleware:
paymentMiddleware("0xYourAddress", { "/your-endpoint": "$0.01" })
The protocol supports multiple "schemes" (payment methods) and blockchain networks. The initial "exact" scheme transfers specific amounts. Payment requirements specify the amount, asset (like USDC), network (like Ethereum or Base), and timeout parameters.
All payment data is transmitted via standard HTTP headers, making it compatible with existing web infrastructure and tools.