Trang này chưa được dịch.

HTTP 402 Payment Required

Reserved for future use; some APIs use it when a payment or plan upgrade is needed.

Cập nhật

402
Payment Required
4xx Client error
Class
RFC 9110 §15.5.3
Defined in

What does HTTP 402 mean?

Reserved for future use; some APIs use it when a payment or plan upgrade is needed. There is no standard behavior, but services such as Stripe, Shopify and various SaaS APIs return 402 when a card is declined, a subscription has lapsed or a quota requires an upgrade.

4xx Client error: The request has a problem the client can fix: wrong URL, missing credentials, bad data or too many requests.

Common causes of a 402 error

  • Failed payment or exceeded paid quota on an API.

How to fix 402 Payment Required

  • Check the billing status of the account.

402 and SEO

Pages should not return 402 to crawlers.

Example response

HTTP/1.1 402 Payment Required

How to return a 402 response

Node.js (Express)

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

PHP

http_response_code(402);

Python (Flask)

return {'error': 'Payment Required'}, 402

Go (net/http)

w.WriteHeader(402)

nginx

return 402;

Related status codes

Check which status code a URL returns with the HTTP header checker.

All HTTP status codesSearch the full list of status codes from 100 to 599 with their meanings and SEO impact.
Open the full list

Câu hỏi thường gặp

What does status code 402 mean?
402 Payment Required: Reserved for future use; some APIs use it when a payment or plan upgrade is needed.
How do I fix a 402 error?
Check the billing status of the account.
Does 402 affect SEO?
Pages should not return 402 to crawlers.