Start free · Free tools · Fair usage limits
Browse Tools

Categories

Custom AI Solutions – AI2Flows
LIVE NEWS
Loading latest AI & SEO news…
Home›Tools›HTTP Status Codes Reference›HTTP 402 Payment Required
4xx Client Error

HTTP 402 Payment Required

HTTP 402 Payment Required is reserved for future use in the HTTP standard, but some services use it to signal a billing problem: an unpaid invoice, an…

Quick answer

HTTP 402 Payment Required is reserved for future use in the HTTP standard, but some services use it to signal a billing problem: an unpaid invoice, an expired subscription or exhausted credits. Its meaning depends entirely on the API that returns it.

Last updated · Maintained by FreeAIToolz · How we test

What does HTTP 402 Payment Required mean?

There is no standard behaviour for 402. Stripe uses it for failed card payments, and many SaaS APIs use it when a plan limit or balance is reached. Some newer agent-payment protocols also use 402 to request payment.

Status code402
NamePayment Required
Class4xx Client Error
Defined inRFC 9110 §15.5.3
Cacheable by defaultNo, unless Cache-Control says so
Safe to retry automatically?No: change the request first

What causes HTTP 402?

  • Billing issue on the account (expired card, unpaid plan).
  • Usage credits exhausted.

How do I fix HTTP 402?

  1. Return a clear message and a link to the billing page.
  2. Prefer 403 or 429 if the issue is a plan restriction or rate limit rather than payment.

What should a client do after HTTP 402?

Do not retry. Resolve the billing problem first.

Does HTTP 402 affect SEO?

Not indexed. Avoid on public pages.

Example 402 response

HTTP/1.1 402 Payment Required
Date: Mon, 01 Dec 2026 12:00:00 GMT
Content-Type: application/json

{"error":{"status":402,"message":"Payment Required"}}

How to return 402 Payment Required in code

Express (Node.js)

res.status(402).json({ error: 'Payment Required' });

Next.js route handler

return Response.json({ error: 'Payment Required' }, { status: 402 });

FastAPI (Python)

raise HTTPException(status_code=402, detail="Payment Required")

PHP

http_response_code(402);

Nginx

location = /example {
    return 402;
}

Other 4xx status codes

The request contains an error or cannot be fulfilled as sent. Fix the request before retrying.

Frequently asked questions

Is 402 a standard error?
The code is registered but its semantics are reserved for future use, so each API defines what it means. Read that API’s documentation.
Should I use 402 for paywalls?
For SEO, no. Paywalled articles should return 200 with paywall structured data so Google can index them.
Is 402 a client or server error?
402 is in the 4xx class, so it is classed as a client error: the request needs to change before it can succeed.