x402 Resource Hub

Your complete guide to HTTP 402 and x402 protocol — documentation, tutorials, whitepapers, and developer resources.

Welcome to the x402 Resource Center

Whether you're a developer looking to implement pay-per-use APIs, a content creator wanting to monetize your work, or an AI agent developer building autonomous payment capabilities, this resource hub has everything you need to get started with x402 and HTTP 402.

The x402 protocol transforms the long-dormant HTTP 402 status code into a powerful, practical payment mechanism. Below you'll find official documentation, code examples, integration guides, and community resources organized by topic and skill level.

🚀 Quick Start

New to x402? Start here to understand the fundamentals and get your first integration running in minutes.

What is x402?

Comprehensive introduction to the x402 protocol, including V2 features, wallet authentication, and multi-chain support.

What is HTTP 402?

Deep dive into the HTTP 402 status code, its history, comparison with other status codes, and why it's finally becoming useful.

How to Pay with USDC

Step-by-step guide for users: set up your wallet, acquire USDC, and make your first x402 payment.

📚 Official Documentation

Authoritative resources from the x402 protocol team and web standards organizations.

x402 Official Website

Protocol overview, ecosystem updates, live demos, and onboarding guides. The primary source for x402 news and announcements.

x402 Whitepaper (PDF)

Complete technical specification covering protocol design, workflow details, security considerations, and implementation guidelines.

x402 GitHub Repository

Open-source reference implementations, SDK code, example applications, and contribution guidelines.

🔧 Developer Tools & SDKs

Libraries and tools to help you integrate x402 into your applications quickly and securely.

Server-Side Libraries

Language Package Description
Node.js @x402/server Express/Fastify middleware for protecting endpoints with 402 payment gates
Python x402-python Django/Flask decorators for adding payment requirements to views
Go x402-go HTTP middleware for Go web frameworks
Rust x402-rs Actix/Axum middleware with async payment verification

Client-Side Libraries

Platform Package Description
JavaScript/TypeScript @x402/client Browser and Node.js client for handling 402 responses and wallet signing
React @x402/react React hooks and components for payment flows
Python x402-requests Requests library extension with automatic 402 handling

📖 Integration Guides

Step-by-step tutorials for common integration scenarios.

API Monetization Guide

Learn how to add pay-per-call pricing to your REST or GraphQL APIs. Covers rate limiting, pricing tiers, and usage analytics.

  • Setting up payment endpoints
  • Configuring price points
  • Handling payment verification
  • Building usage dashboards

Content Paywall Integration

Implement micropayments for articles, videos, or downloads without subscriptions.

  • Server-side content gating
  • Client-side unlock flows
  • Caching paid content
  • Revenue tracking

AI Agent Payment Setup

Enable autonomous agents to access paid resources and make payments without human intervention.

  • Wallet configuration for agents
  • Automatic 402 response handling
  • Budget limits and controls
  • Payment logging and auditing

Multi-Chain Configuration

Accept payments on multiple blockchains: Ethereum, Base, Polygon, Arbitrum, and more.

  • Chain-specific configurations
  • USDC contract addresses
  • Gas optimization strategies
  • Cross-chain settlement

🌐 HTTP Standards & References

Official web standards documentation for HTTP status codes and payment protocols.

MDN: 402 Payment Required

Mozilla Developer Network's comprehensive reference for the 402 status code, including browser compatibility and usage notes.

RFC 9110: HTTP Semantics

The official IETF specification for HTTP, including the definition of 402 as a reserved status code.

Wikipedia: HTTP 402

Historical context, timeline of 402 development, and overview of implementation attempts over the years.

HTTP Status Codes Reference

Quick reference for all HTTP status codes with explanations and related codes.

💰 USDC & Stablecoin Resources

Understanding the payment layer that powers x402 transactions.

USDC by Circle

Official documentation for USDC, the dollar-backed stablecoin used in x402 payments. Learn about reserves, audits, and supported chains.

Circle Developer Docs

Technical documentation for integrating USDC, including API references, SDKs, and best practices.

Supported Chains

x402 supports USDC on multiple networks for maximum flexibility:

  • Ethereum Mainnet - The original, most liquid market
  • Base - Coinbase's L2 with low fees
  • Polygon - Fast, cheap transactions
  • Arbitrum - Ethereum L2 with strong DeFi ecosystem
  • Optimism - Another popular Ethereum L2

🎓 Learning Paths

Structured learning journeys based on your role and goals.

For API Developers

  1. Read What is HTTP 402? to understand the status code
  2. Study What is x402? for protocol mechanics
  3. Review the whitepaper for technical details
  4. Explore example implementations on GitHub
  5. Implement a test endpoint in your development environment
  6. Deploy to production with proper monitoring

For Content Creators

  1. Understand how payments work from the user perspective
  2. Learn about x402 V2 features including session reuse
  3. Choose a platform or CMS with x402 support
  4. Configure pricing for your content
  5. Set up payment notifications and analytics

For AI/Agent Developers

  1. Study x402 protocol flow for programmatic handling
  2. Configure agent wallets with appropriate spending limits
  3. Implement automatic 402 response detection
  4. Build payment decision logic
  5. Add logging and budget monitoring

🔗 Community & Support

Connect with the x402 community and get help when you need it.

GitHub Discussions

Ask questions, share implementations, and discuss protocol improvements with the community.

Join Discussions →

Stack Overflow

Technical Q&A for x402 implementation issues. Use the [x402] tag for visibility.

Browse Questions →

Twitter/X Community

Follow @x402protocol for announcements, tips, and ecosystem news.

Contact Us

Have questions about this documentation? Reach out to whatisx402@gmail.com

📋 Comparison: x402 vs Traditional Payment Solutions

Understanding how x402 compares to existing payment integration options.

Feature x402 Stripe/PayPal Crypto Manual
Micropayments (<$1) ✅ Efficient ❌ Fee prohibitive ⚠️ Gas costs vary
No Account Required ✅ Wallet only ❌ Account needed ✅ Wallet only
Machine-to-Machine ✅ First-class ❌ Not supported ⚠️ Complex
HTTP Native ✅ 402 status ❌ Redirects ❌ Custom flow
Global Access ✅ Permissionless ⚠️ Geo-restricted ✅ Permissionless
Instant Settlement ✅ Blockchain ❌ Days delay ✅ Blockchain

🛡️ Security Best Practices

Essential security considerations when implementing x402.

📊 Analytics & Monitoring

Track and optimize your x402 payment implementation.

❓ Frequently Asked Questions

Is x402 production-ready?

Yes, x402 V2 is production-ready and being used by multiple applications. The protocol is backed by Coinbase and has undergone extensive testing.

What are the transaction fees?

Fees depend on the blockchain used. Base and Polygon offer sub-cent fees, while Ethereum mainnet may cost a few dollars per transaction.

Can I accept multiple currencies?

Currently, x402 focuses on USDC for simplicity and regulatory compliance. Multi-currency support is on the roadmap.

How do refunds work?

Refunds are handled at the application layer. Since payments are on-chain, you would send a separate transaction to refund the user's wallet.

Is KYC required?

x402 is permissionless — no KYC required for users. However, as a merchant, you may have compliance obligations depending on your jurisdiction.