Verify checkout info

[Step 5 of 9] The buyer is redirected to the checkoutResultReturnUrl you specified in the Checkout Session, after processing on Amazon Pay side is completed. Verify that the status of the Checkout Session object is OPEN after the buyer comes back from Amazon Pay Processing page.


1. Verify Checkout Session state

Get Checkout Session to verify that the Checkout Session is in the OPEN state. See Checkout Session state explanation’ table below for more info.

Checkout Session state explanation

Checkout Session State
Description
Open
Checkout was confirmed, but payment is not completed yet. You should:

1. Proceed to execute the payment processing part of the checkout, interacting with your acquirer.
Canceled
Checkout was not successful. The buyer either canceled checkout or was unable to provide a valid payment instrument. See Checkout Session canceled state reason code for more info.

The buyer can no longer complete checkout using the same Checkout Session ID. You should:

1. Redirect the buyer to the start of checkout.
2. Display a message such as: "Your payment was not successful. Please try another payment method.“
3. Create a new Checkout Session if the buyer clicks on the Amazon Pay button again.

Request

curl "https://pay-api.amazon.com/:version/checkoutSessions/:checkoutSessionId"
-X GET
-H "x-amz-pay-authorization: Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"

Request parameters

Name
Location
Description
CheckoutSessionId
(required)

Type: string
Path Parameter
Checkout session identifier

Response

{
    "checkoutSessionId":"bd504926-f659-4ad7-a1a9-9a747aaf5275",
    "statusDetails": {
        "state": "Open",
        "reasonCode": null,
        "reasonDescription": null,
        "lastUpdatedTimestamp": "20191015T204327Z"
    },
    "creationTimestamp": "20190714T155300Z",
    "chargePermissionId": "chargePermissionId-1",
    "amazonPayToken": "497268187623AMZN"     
}

2. Retrieve the amazonPayToken

Parsing the Get Checkout Session API response, retrieve the amazonPayToken provided after the buyer returns from the Amazon Pay Processing page.

The amazonPayToken is returned only if the buyer successfully goes through the Amazon Pay Processing page, and represents the unique identifier needed to process the payment with your acquirer, as explained in the following section of the integration guide.

Best practice: Make sure that the checkoutResultReturnUrl being passed in the Checkout Session is pointing to the location on your website in which the payment processing happens. Once the customer returns from the Amazon Pay Processing page, the transaction should be processed with the acquirer, as described in the next step of the guide.