Verify & complete checkout
[Step 4 of 7] When the onCompleteCheckout
event handler is invoked, utilize the Finalize Checkout Session
API, which enables Amazon Pay to validate payment critical attributes. This API replaces the Complete Checkout Session
API of the standard Amazon Pay CV2integration flow. As the API validates critical information, only consider the checkout successful, if you get a successful response from this API. At the end of this step, you will be able to present the buyer with the checkout result.
Finalize Checkout Session
Use Finalize Checkout Session to confirm you have successfully received the onCompleteCheckout
event.
The chargeAmount
in the request must match the Checkout Session object paymentDetails.chargeAmount
to verify order amount. You must also specify totalOrderAmount
and supplementaryData
if one was provided for the Checkout Session. For PayAndShip
use cases, the shippingAddress
is also required and must match the address shared by Amazon. For PayOnly
use cases, the same requirement exists for the billingAddress
.
paymentIntent
until you confirm checkout with Finalize Checkout Session. Any Checkout Session that is not confirmed within 24 hours will be cancelled. If payment authorization was requested it will also be cancelled.Successful response:
Finalize Checkout Session will return a success response if the transaction was processed successfully. Implement the guidance that corresponds to the Checkout Session paymentIntent
:
paymentIntent
|
Description
|
AuthorizeWithCapture
|
Payment has been authorized and captured. 1. Store the ChargeId - You must store the ChargeId to process refunds.2. Store the ChargePermissionId - If you specified totalOrderAmount and there is uncaptured payment, see manage deferred payments for more information. You can also use the ChargePermissionId to retrieve buyer and transaction info using Get Charge Permission for 30 days, you must store the data to persist the information beyond 30 days.
|
Authorize
|
Payment has been authorized. 1. Store the ChargeId - You must store the ChargeID for deferred payment capture. See deferred transactions for more info.2. Store the ChargePermissionId - If you specified totalOrderAmount and there is uncaptured payment, see manage deferred payments for more information. You can also use the ChargePermissionId to retrieve buyer and transaction info using Get Charge Permission for 30 days, you must store the data to persist the information beyond 30 days.
|
Confirm
|
Payment has not been authorized or captured. 1. Store the ChargePermissionId - You must store the ChargePermissionId for deferred payment authorization. See deferred transactions for more info. You can also use the ChargePermissionId to retrieve buyer and transaction info after checkout. You will only be able to retrieve the data using Get Charge Permission for 30 days, you must store the data to persist the information beyond 30 days.
|
Error response:
Finalize Checkout Session will return an error response for failed transactions. The buyer either canceled checkout or was unable to provide a valid payment instrument. 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.“