HTTP 402 Payment Required
The HTTP status code reserved for digital payment systems. Learn how to implement payment-required responses for API monetization and agent commerce.
What is HTTP 402?
HTTP 402 Payment Required is a standard HTTP status code that was originally reserved for future use in digital payment systems. It indicates that payment is required to access the requested resource.
When a server returns a 402 response, it signals to the client that the request cannot be fulfilled without payment. The response typically includes information about the payment amount, currency, and payment methods accepted.
While HTTP 402 has been part of the HTTP specification since HTTP/1.1, it remained largely unused until recent interest in API monetization and agent-to-agent commerce revived its purpose.
How HTTP 402 works
- Client requests a resource - The client makes an HTTP request to a protected endpoint
- Server returns 402 - The server responds with HTTP 402 Payment Required, including payment details in the response body
- Client makes payment - The client processes the payment through the specified payment method
- Client retries with proof - The client retries the original request with a payment receipt or proof of payment
Basic HTTP 402 response
HTTP/1.1 402 Payment Required
Content-Type: application/json
Cache-Control: no-store
{
"error": "Payment required",
"message": "Access to this resource requires payment",
"amount": "0.10 USD"
}HTTP 402 vs x402
HTTP 402
The HTTP status code itself. Part of the HTTP/1.1 specification.
- Standard status code
- No specific format
- Implementation-agnostic
x402
A protocol specification for implementing HTTP 402 in practice.
- Standardized headers
- Payment challenge format
- Receipt verification
Use cases for HTTP 402
API Monetization
Charge for API access on a per-request or subscription basis. Enable pay-per-use pricing models.
Agent Commerce
Enable autonomous agents to discover pricing and pay for services automatically.
Content Paywalls
Protect premium content behind payment requirements with verifiable receipts.
Implement HTTP 402 in your application
x402 Protocol Guide
Learn how to implement HTTP 402 using the x402 protocol with standardized headers and receipt formats.
Gateway 402
Enterprise HTTP 402 payment gateway with multi-rail settlement support and verifiable receipts.
HTTP 402 Glossary
Detailed explanation of HTTP 402 Payment Required status code and related concepts.
Ready to add HTTP 402 to your API?
Get started with our developer tools and implementation guides.