402 Payment Required
4xx client error
Reserved for future use; some APIs use it to signal a billing problem.
402 was reserved in early HTTP for digital payment schemes that never materialised, and the spec still lists it as reserved. A few APIs use it to say the account needs to pay: Stripe returns 402 when a request fails despite valid parameters, such as a declined card, and some SaaS APIs use it when a trial or quota runs out.
| Class | 4xx Client Error |
|---|---|
| Retry? | No — change the request first |
| Cacheable by default | No — only with explicit Cache-Control |
| Response body | Allowed |
| Defined in | RFC 9110 §15.5.3 — 402 Payment Required |
Example response
HTTP/1.1 402 Payment Required
Content-Type: application/json
Content-Length: 28
{"error":"Payment Required"}Common causes
- A payment API couldn't complete a charge (a card decline, for example).
- A subscription lapsed, or a paid feature was requested on a free plan.
How to fix it
- Read the error body — it usually names the billing reason.
- Update the payment method or upgrade the plan in the provider's dashboard.
- In your own API, prefer 403 with a clear error code unless your clients are known to handle 402.
Send a 402 from your server
Express
res.status(402).json({ error: "Payment Required" });Next.js route handler
return Response.json({ error: "Payment Required" }, { status: 402 });Flask
return {"error": "Payment Required"}, 402Go net/http
http.Error(w, "Payment Required", http.StatusPaymentRequired)
nginx
return 402;
Check what a URL returns
Print just the status line from the command line, or check a whole list of URLs at once, with their response headers, in the HTTP Status Checker.
curl -sI https://example.com/your-path | head -n 1
Frequently asked questions
Should I use 402 in my API?
It's allowed but has no standard meaning, so generic clients won't treat it specially. If you use it, document it and return a descriptive error body.
Related status codes