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
You should use 4xx for a client error if the client can modify the request to get around the error. Use a 5xx for a server error that the client can't really work around.
Product sold out would be a server error. The client can't modify the request in some fashion to get around the error. You could switch to another product but wouldn't that be a new request?
User maximum order limit reached is also a server error. Nothing the client can do to work around that error.
Credit card transaction failure would be a client error. The client could resubmit the request with a different payment method or credit card number to work around the error.