402 Payment Required

Reserved; used by some APIs for billing problems.

When to use it

Plan limit reached or payment failed.

Common causes and fixes

402 was reserved for future use and never standardised, so its meaning depends on the API. Stripe returns 402 when a card is declined or a charge fails, with the reason in the error body, and Shopify returns it when a store is frozen for unpaid bills. Other SaaS APIs use it when a trial ends or a plan limit is reached. Read the error code in the body, not only the status.

Don’t retry 402 automatically: it won’t clear until someone updates billing or upgrades the plan, so surface it to a human with a link to the billing page. If you design an API, 402 is a reasonable choice for billing blocks, distinct from 403 for permissions and 429 for rate limits, but document it, because generic clients just treat it as an unknown 4xx error.

Client error (4xx)

4xx codes are client errors: the request itself is wrong, unauthorised or points at something that isn’t there. Retrying the same request won’t help.

What it looks like

HTTP/1.1 402 Payment Required

How to send it

Node.js / Expressres.status(402).end()
Python / Flaskreturn '', 402
nginxreturn 402;

How to check it

curl -s -o /dev/null -w "%{http_code}\n" https://example.com/

Open HTTP Status Codes