Checkout Session
(checkoutSessionId)
(chargePermissionId)
(chargeId)
(refundId)
Get Checkout Session
- JP
- US
- EU/UK
When do I use Get Checkout Session?
When a buyer clicks Amazon Pay button, a buyer is redirected to Amazon Pay Hosted page. A buyer signs in and click "Continue" on Amazon Pay Hosted page. Then Amazon Pay redirects buyer to merchant's checkoutReviewReturnUrl.
At this timing, Amazon adds checkoutSessionId as a URL parameter to checkoutReviewReturnUrl.
You will use this checkoutSessionId to call Get Checkout Session API to get buyer information, shipping address, payment instrument and etc.
Once you get such data in API response, you will render them on your "Order Review" page.
(It happens between the part enclosed by orange rectangle)
Merchant site | |||||
● ● ● Cart page | ● ● ● Order review page | ● ● ● Order confirmation page ✔️ | |||
Amazon Pay Hosted page | |||||
Merchant |
i.e. Assuming Merchants's checkoutReviewReturnUrl: https://anyurl.com/review/
Amazon Pay adds checkoutSesionId as URL parameter. i.e. https://anyurl.com/review/? amazonCheckoutSessionId=26be7331-7dc2-4722-be22-f7e75582d3ef
Ref:
Update Checkout Session
- JP
- US
- EU/UK
When do I use Update Checkout Session?
Assuming final charge amount is decided after adding shipping fee and/or campain discount on "Order Review" page. Then, you need to reflect such final payment details to Checkout Session object by calling Update Checkout Session API. (It happens between the part enclosed by orange rectangle)
Merchant site | |||||
● ● ● Cart page | ● ● ● Order review page | ● ● ● Order confirmation page ✔️ | |||
Amazon Pay Hosted page | |||||
Merchant |
If you already know the final charge amount and shipping address at the timing of rendering Amazon Pay button, you may better use APB (Additional Payment Button) instead.
See
Complete Checkout Session
- JP
- US
- EU/UK
When do I use Complete Checkout Session?
When a buyer clicks "Place Order" button (and after calling Update Checkoout Session API as needed), merchant redirects to amazonPayRedirectUrl. Once Amazon Pay is ready for payment, Amazon redirects to merchant's checkoutResultReturnUrl. At this timing, you call Complete Checkout Session API *to complete checkout session. (It happens between the part enclosed by orange rectangle).
Merchant site | |||||
● ● ● Cart page | ● ● ● Order review page | ● ● ● Order confirmation page ✔️ | |||
Amazon Pay Hosted page | |||||
Merchant |
Checkout Session is valid for 24 hours, so if the buyer leaves your website before completing checkout and came back to the site after a while (within 24 hours), you may use the same Checkout Session to complete the chekcout session.
If you integrate such flow, please make sure to save checkoutSessionId linked to your order information in your database.
Once Complete Checkout Session API successfully completes, Amazon Pay returns following two IDs in response;
- chargePermissionId
- chargeId(only if you obtained Authorization during checkout session)
You need these IDs for subsequent processes (such as settlement, additional charge and refund etc), so please make sure to save these IDs linked to your order information in your databse.
See