Handle authorization declines
[Step 7 of 9] In this section you will leard how to handle payment error scenarios. During the communication with your acquirer, and during the processing of the payment, an error can occur. Errors can be due to various reasons, but can be categorized in two main buckets: recoverable and not recoverable.
1. Handle Not Recoverable Declines
In case of any generic decline coming from your Acquirer, which can be related to a potential fraud detected on the order, or a system error, the buyer needs to be informed that the transaction could not be completed. You should:
- Redirect the buyer to the start of checkout
- Display a message such as: "Your payment was not successful. Please try another payment method.“
2. Handle Recoverable Declines
In case of a processor decline, caused for example by an expired credit card or insufficient funds, a specific authorization decline should be returned from your acquirer API. In case such decline is returned, you should offer the buyer the possibility to select a new credit card from the Amazon account and try to place the order again. This recovery flow will be available in the Amazon Pay Decline page, hosted on Amazon Pay domain.
2.1 Get Checkout Session
In case of a processor decline being returned by the acquirer, call Get Checkout Session to retrieve the details of the object. A new
amazonPayRedirectUrl will be returned as part of the API response.
Note: Please make sure to check the
checkoutResultReturnUrl parameter you find in the Checkout Session details. After the Amazon Pay Decline page, the buyer will be sent back to
checkoutResultReturnUrl. On this endpoint the logic to process the payment with the acquirer should be executed. If such endpoint should be different from the one the buyer was redirected to after the Amazon Pay Processing page, update the endpoint calling Update Checkout Session.
2.2 Redirect buyer to the Amazon Pay Decline Handling page
Once you retrieved the new
amazonPayRedirectUrl, redirect the buyer to the Amazon Pay Decline Handling page. In this page, the buyer will be able to see the rejected credit card used for the first authorization attempt, and select another one from the Amazon account to try a new payment attempt.
2.3 Repeat Step 6 to try a new payment attempt
When the buyer confirms the new credit card selected from the Amazon wallet, buyer will be redirected to the
At this point you should try to process the payment again following the same instructions outlined in Step 6 of this guide.