402 Payment Required
402 Payment Required
is a status-code described by the standard as:
The 402 (Payment Required) status code is reserved for future use.
The original idea may have been that commercial websites and APIs would want to have a default way to communicate that a HTTP request can be repeated, after a user paid for service.
Usage
The RFC suggests that it’s not a good idea to use this status code today, because it may get a better definition in the future, possibly making existing sites incompatible with HTTP.
That being said, it hasn’t really stopped people from using the code anyway.
- The Shopify API uses it to indicate a “shop is frozen”.
- Pubnub also uses it to indicate that a feature needs to be paid for.
- Youtube may be using it to rate-limit abusers.
So should you use it? The RFC says no. But, I also don’t think there’s a major risk in doing so.
References
- RFC7231, Section 6.5.2 - 402 Payment Required