x402
x402¶
Overview¶
x402 is a Web3-native payment protocol based on the HTTP 402 status code, proposed and promoted by the Base chain. The HTTP 402 "Payment Required" status code has long been reserved but rarely used in the traditional internet. The x402 protocol redefines it as a standard interface for blockchain payments, enabling web applications to seamlessly integrate cryptocurrency payment functionality.
The protocol aims to bridge the gap between Web2 and Web3 payments, allowing developers to handle on-chain payment requests just like traditional HTTP status codes. Through standardized APIs and response formats, x402 lowers the technical barrier for Web3 payment integration, providing a unified solution for content monetization, subscription services, API billing, and other scenarios.
As a key piece of infrastructure in the Base ecosystem, the x402 protocol combines with smart wallets, account abstraction, and other technologies to provide users with a smooth payment experience without complex wallet operations or gas management.
Core Features¶
HTTP 402 Status Code Standardization The x402 protocol redefines the HTTP 402 status code as a payment request signal. When a server returns a 402 status code, the response headers contain payment details (amount, receiving address, supported tokens, etc.), and the client can automatically parse and complete the payment. This design enables the payment flow to seamlessly integrate with existing web infrastructure.
Multi-Token Support The protocol supports payments in multiple cryptocurrencies and tokens, including ETH, stablecoins (USDC, DAI), and project tokens. Developers can flexibly configure accepted payment methods, and users can pay with the assets they hold.
Account Abstraction Integration x402 deeply integrates the ERC-4337 account abstraction standard, supporting smart contract wallets, social recovery, gas sponsorship, and other advanced features. Users do not need to manually manage private keys and gas fees, providing a payment experience close to traditional internet payments.
Instant Confirmation Through Base Layer 2's fast block times and low latency, x402 payments can be confirmed within seconds. For small payments, the protocol also supports optimistic confirmation mechanisms, further improving user experience.
Developer-Friendly The protocol provides complete SDKs and libraries, supporting mainstream programming languages (JavaScript, Python, Go, etc.). Developers can add x402 payment functionality to existing applications with just a few lines of code, without needing a deep understanding of blockchain technology.
Core Advantages¶
Lower Integration Barrier By reusing the familiar HTTP status code mechanism, x402 enables Web2 developers to quickly understand and integrate Web3 payments without learning an entirely new protocol stack.
Cross-Platform Compatibility The protocol design follows web standards and can be used in browsers, mobile applications, server-side environments, and other contexts, achieving truly cross-platform payments.
Scalability Built on Base Layer 2's high-performance infrastructure, x402 can support large-scale concurrent payment requests, meeting the needs of commercial applications.
Security Assurance Payment information is verified through smart contracts, preventing tampering and fraud. User funds remain under their own control at all times, avoiding custodial risks.
Use Cases¶
Content Monetization: Pay-per-view or subscription services for articles, videos, audio, and other digital content, allowing creators to earn directly from users.
API Billing: Usage-based billing for developer APIs, AI model calls, data services, enabling granular micropayments.
Subscription Services: Subscription payments for SaaS applications, membership services, and online tools, supporting automatic renewal and flexible billing cycles.
In-Game Purchases: Item purchases and feature unlocks in blockchain games, providing a smooth payment experience.
Tips and Donations: Creator tipping features on social platforms and live-streaming applications, reducing payment friction.