We’ve got our token and we’ve sent our form to the server for the actual credit card charge. Now we have to deal with a wide array of things that can go wrong in the server request.
We’re going to see some code suggestions for handling various kinds of problems that might come up, but it’s important to realize that error handling is not a one-size-fits-all kind of proposition. The general principles are going to likely need some adaptation to the specific business logic of your application.
Very broadly, our purchase process has three steps:
The pre-purchase checklist. We must make sure we have all the data we need, and that the data is valid and in the necessary format.
The actual API call, which we need to make sure is ...