Navigation
What is HTTP Status Code 402 Payment Required?
The status code 402 (Payment Required) has been set aside for future usage.
It’s possible that the initial aim was for commercial websites and APIs to have a default mechanism to signal that an HTTP request can be repeated after a customer paid for a service.
Any private feeds on the account will become read-only for a period of 7 days if the owner of the feed downgrades a premium membership to a free one or if the subscription expires. After this time, the feed will be shut, and you won’t be able to view it unless you renew your membership or the stream is made public.
Locked feeds will not be made public, and they will not be deleted automatically.
When you upgrade to a premium membership, you’ll have access to the private feed. Another approach is to open the stream to the public and re-enable access. It’s worth noting that making the stream public makes it available to everyone.
Status
402 Payment Required
Example response
HTTP/1.1 402 Payment Required
Date: Wed, 21 Oct 2015 07:28:00 GMT
Specifications
Specification | Title |
RFC 7231, section 6.5.2: 402 Payment Required | HTTP/1.1: Semantics and Content |
Usage
It’s not a good idea to use this status code right now, according to the RFC, because it may gain a better definition in the future, perhaps rendering current sites incompatible with HTTP.
However, it hasn’t stopped individuals from employing the code in the first place.
It’s used by the Shopify API to signal that a “shop is frozen.”
It’s also used by Pubnub to signal that a feature requires payment.
It’s possible that Youtube is utilizing it to rate-limit offenders.
It is used by the Google Survey API for different sorts of limitations.
So, should you put it to use? No, according to the RFC. However, I don’t believe there is a significant risk in doing so.
402 Code References
Rails HTTP Status Symbol :payment_required
Go HTTP Status Constant http.StatusPaymentRequired
Symfony HTTP Status Constant Response::HTTP_PAYMENT_REQUIRED
Python2 HTTP Status Constant httplib.PAYMENT_REQUIRED
Python3+ HTTP Status Constant http.client.PAYMENT_REQUIRED
Python3.5+ HTTP Status Constant http.HTTPStatus.PAYMENT_REQUIRED
FAQs
What does status code 402 error mean?
The private feed is locked because the feed owner’s subscription has expired, as shown by the 402 Payment Required status code.
What do you mean by status code in HTTP?
When a server receives a request from a client, it responds with a status code. It contains codes from IETF Request for Comments (RFCs), other standards, and some extra codes that are used in some typical HTTP applications.
Related Post
HTTP Status Code 101-Switching Protocols
HTTP Status Code 205 Reset Content
HTTP Status Code 300-Multiple Choices
HTTP Status Code 204 – No Content
HTTP Status Code 203 – Non-authoritative Information
HTTP Status Code 207 Multi-Status
HTTP Status Code 208 Already Reported
HTTP Status Code 400 Bad Request
HTTP Status Code 401 Unauthorized
Conclusion
I hope this article was able to help you with your doubts and queries related to the HTTP status code 402 Payment Required. Still, if there are any queries related to this topic, feel free to ask in the comment section, we would be happy to assist you. Thank you.
Kedar Dangal
Making a difference, Adding the sum.