402 Payment Required

Reserved for future use, now used by some APIs to say payment is needed.

Code
402
Reason phrase
Payment Required
Class
4xx Client error
Defined in
RFC 9110 section 15.5.3
Cacheable by default
No

What it means

Client error: the problem lies with the request. Repeating it unchanged will normally fail again.

When a server should send it. The standard still marks it as reserved for future use, with no agreed meaning. Some APIs use it for an unpaid account or an exhausted paid quota; if you do, explain the problem and the fix in the body.

Common causes. An unpaid account, an expired plan or a used up quota on a paid API.

What to do. Check billing on the service's account page.

How clients and crawlers treat it

Browsers and HTTP clients. Browsers show the body like any other error. There is no standard client behaviour.

Google Search. Like every 4xx except 429, it tells Google the content does not exist: an indexed URL is removed from the index, and a new one is not processed. Crawl frequency for the URL gradually drops. Source: Google Search Central, How HTTP status codes, and network and DNS errors affect Google Search.

Caching. Not cacheable by default (RFC 9110 section 15.1 does not list it). A cache stores it only when the response says so with Cache-Control or Expires.

Example response

HTTP/1.1 402 Payment Required
Content-Type: text/plain; charset=utf-8

Payment Required

How to send 402

nginx
location /example {
    return 402;
}
Apache (.htaccess)
RewriteEngine On
RewriteRule ^example$ - [R=402,L]
PHP
http_response_code(402);
echo 'Payment Required';
exit;
Node.js
res.writeHead(402, { 'Content-Type': 'text/plain' });
res.end('Payment Required');
Python (Flask)
# in a view function
return 'Payment Required', 402

Change the paths to suit. In nginx, add_header needs always to apply to error responses.

Related codes

All status codes · All 4xx codes

Names and numbers from the IANA HTTP Status Code Registry. Google Search behaviour as documented by Google Search Central.