Key Takeaways
- HTTP 402 is a standard status code for "Payment Required" - reserved since 1999
- Enables pay-per-request APIs without subscriptions or pre-purchased credits
- x402 is the modern implementation with pricing headers and payment proofs
- Combined with PEAC receipts, creates a complete payment + audit trail
What is HTTP 402?
HTTP 402 Payment Required is a status code that was defined in HTTP/1.1 back in 1999 but marked as “reserved for future use.” The web wasn't ready for native payments then - no infrastructure existed to handle micropayments programmatically.
Today, with AI agents needing to pay for API access in real-time, HTTP 402 has finally found its purpose. When a server returns 402, it's saying: “I can fulfill your request, but you need to pay first.”
Why It Matters for AI
Traditional API monetization requires humans to:
- Sign up for an account
- Enter credit card information
- Purchase credits or subscribe to a plan
- Manage API keys
AI agents can't do any of this. HTTP 402 enables agents to discover pricing, pay instantly, and access resources - all in a single HTTP request/response cycle. No accounts. No subscriptions. No human in the loop.
How It Works
Agent makes request
Agent sends HTTP request to API endpoint without payment
Server returns 402
Server responds with pricing info in headers (amount, currency, payment methods)
Agent makes payment
Agent processes payment via supported method (crypto, Stripe, etc.)
Agent retries with proof
Agent retries request with payment proof in header
Server fulfills + receipt
Server validates payment, fulfills request, returns PEAC-Receipt
x402 Protocol
x402 is the practical implementation of HTTP 402 for machine payments. Originary provides integration tooling for x402, which defines:
- 402 response body - Machine-readable pricing info (amount, currency, accepted methods)
- Payment proof - Cryptographic proof submitted with the retry request
- Payment methods - Standard identifiers for crypto, Stripe, and other rails
- Error codes - Specific failure modes (insufficient funds, expired proof, etc.)
x402 Integration Guide
Implement x402 in your API or agent
Further Reading
Deep dives into HTTP 402 and machine payments from our blog: