I\'m creating a RESTful API that will process a number of user interactions, including placing orders using stored credit cards.
In the case of a successful order, I
I know this question is old, but I came up with the very same question today. If my user runs out of credits, what status code should my REST API return?
I tend to lean towards 402 Payment Required
:
According to Wikipedia:
Reserved for future use. The original intention was that this code might be used as part of some form of digital cash or micropayment scheme, but that has not happened, and this code is not usually used. Google Developers API uses this status if a particular developer has exceeded the daily limit on requests.
And indeed they do:
PAYMENT_REQUIRED (402)
- A daily budget limit set by the developer has been reached.
- The requested operation requires more resources than the quota allows. Payment is required to complete the operation.
- The requested operation requires some kind of payment from the authenticated user.