4xx Client Errors

HTTP 402 Payment Required

Reserved for future use. Originally intended for digital payment systems.

When is 402 used?

  • Subscription payment required
  • Paywall enforcement

How to handle a 402 response

Inspect the request — URL, method, headers, credentials, and body. Retrying the same request unchanged will usually fail again; 429 is the exception, where you should wait for the Retry-After period.

Check the status code a URL returns from the command line:

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

How to return 402 from your server

Node.js (Express)

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

Python (Flask)

return {"message": "Payment Required"}, 402

Go (net/http)

w.WriteHeader(402)

Frequently Asked Questions

What does HTTP 402 mean?

402 Payment Required: Reserved for future use. Originally intended for digital payment systems.

Is 402 an error?

Yes. 402 is in the 4xx Client Errors class. Client errors: the request is malformed, unauthorized, or targets something that does not exist.