402 Payment Required
Reserved for future use by the HTTP specification, with no standard semantics. Some APIs (Stripe, for example) use it to signal that a payment failed or a paid plan is required.
The request cannot be processed until the client makes a payment.
What HTTP 402 Payment Required Means
The request cannot be processed until the client makes a payment.
Reserved for future use by the HTTP specification, with no standard semantics. Some APIs (Stripe, for example) use it to signal that a payment failed or a paid plan is required.
Common Causes
- API subscription expired or unpaid
- Free-tier quota exhausted
- Payment method declined
- Account requires an upgrade to access the resource
How to Fix It (For Visitors)
- Add or update your payment method
- Upgrade your plan
- Check billing emails from the service
How to Fix It (For Developers/Admins)
- Return 402 with a clear billing message and link
- Document required plans in your API reference
- Include the failed charge ID for support
Returning a 402 Payment Required (Code Examples)
If you build APIs or web apps, here is how to send an HTTP 402 response and how to test for it:
Node.js (Express)
app.get('/resource', (req, res) => {
res.status(402).json({ error: 'Payment Required' });
});
Python (Flask)
@app.route('/resource')
def resource():
return jsonify(error='Payment Required'), 402
PHP
<?php
http_response_code(402);
header('Content-Type: application/json');
echo json_encode(['error' => 'Payment Required']);
Check the status with curl
curl -I https://example.com/resource
# Look for: HTTP/1.1 402 Payment Required
Frequently Asked Questions
What does HTTP 402 Payment Required mean?
Reserved for future use by the HTTP specification, with no standard semantics. Some APIs (Stripe, for example) use it to signal that a payment failed or a paid plan is required. In short: The request cannot be processed until the client makes a payment.
Is 402 Payment Required a client or server error?
402 is a 4xx client-error code, so the request itself needs to change. The server is running normally and is rejecting the request as it was sent by the browser, app, or API client.
How do I fix a 402 Payment Required error?
Return 402 with a clear billing message and link. Document required plans in your API reference. Include the failed charge ID for support.
Official Specification
The 402 Payment Required status code is defined in RFC 9110 Section 15.5.3.