HTTP/4xx (Client Error)
402 Payment Required
Reserved for future use; commonly used by SaaS APIs to signal exhausted credits, failed billing, or an expired plan.
❓ Why does this happen?
API quota for a paid plan is exhausted, or the account's payment method failed (Stripe, OpenAI, Vercel, Shopify).
✅ How to fix it
Check the billing dashboard of the provider, update the payment method, or upgrade the plan before retrying.
Return or handle 402 in your stack
// app/api/resource/route.ts
export function GET() {
return Response.json(
{ error: "Payment Required", status: 402 },
{
status: 402
}
);
}Live 402 mock endpoint
Point your app, tests, or retry logic at this free public URL to reproduce a real 402 response (CORS enabled, optional ?delay=ms up to 5000).
https://castov.com/api/mock/402Frequently Asked Questions
What does HTTP Status 402 mean?
Why am I getting a 402 status code?
How do I fix a 402 Payment Required error?
How can I test how my app handles a 402 response?
Other 4xx status codes
Browse the full HTTP status codes directory or troubleshoot terminal errors in the Error Fix Encyclopedia.