Skip to main content
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/402

Frequently Asked Questions

What does HTTP Status 402 mean?
Reserved for future use; commonly used by SaaS APIs to signal exhausted credits, failed billing, or an expired plan.
Why am I getting a 402 status code?
API quota for a paid plan is exhausted, or the account's payment method failed (Stripe, OpenAI, Vercel, Shopify).
How do I fix a 402 Payment Required error?
Check the billing dashboard of the provider, update the payment method, or upgrade the plan before retrying.
How can I test how my app handles a 402 response?
Send a request to https://castov.com/api/mock/402 — it returns a real 402 Payment Required response with CORS enabled. Add ?delay=2000 to simulate a slow server.

Other 4xx status codes

Browse the full HTTP status codes directory or troubleshoot terminal errors in the Error Fix Encyclopedia.