Verify & complete checkout
[Step 6 of 10] The buyer is redirected to checkoutResultReturnUrl
after Amazon Pay has processed the transaction or setup. The Amazon Pay checkout session ID will be included as a query parameter.
In this step, you will use the checkout session ID to confirm that the buyer has successfully returned to your site. At the end of this step, you will be able to present the buyer with the checkout result.
1. Complete Checkout Session
Use Complete Checkout Session to confirm that the buyer has successfully returned to your site. The chargeAmount
in the request must match the Checkout Session object paymentDetails.chargeAmount to verify order amount. You must also specify totalOrderAmount if one was provided for the Checkout Session object.
Note:
Amazon Pay will not finalize the paymentIntent
until you confirm checkout with Complete Checkout Session. Any Checkout Session that is not confirmed within 24 hours will be cancelled.
Successful response:
Complete Checkout Session will return a success response if the setup 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 3. If ChargePermissionType is "PaymentMethodOnFile", it indicates the buyer has consented to save the selected payment instrument for future purchases. You can use ChargePermissionId to charge the buyer for future purchases. You can also use the ChargePermissionId anytime to retrieve buyer and transaction info using Get Charge Permission4. If ChargePermissionType is "OneTime", it indicates the buyer didn't consent to save the selected payment instrument for future purchases. 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 to process refunds.2. Store the ChargePermissionId 3. If ChargePermissionType is "PaymentMethodOnFile", it indicates the buyer has consented to save the selected payment instrument for future purchases. You can use ChargePermissionId to charge the buyer for future purchases. You can also use the ChargePermissionId anytime to retrieve buyer and transaction info using Get Charge Permission4. If ChargePermissionType is "OneTime", it indicates the buyer didn't consent to save the selected payment instrument for future purchases. 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 2. If ChargePermissionType is "PaymentMethodOnFile", it indicates the buyer has consented to save the selected payment instrument for future purchases. You can use ChargePermissionId to charge the buyer for future purchases. You can also use the ChargePermissionId anytime to retrieve buyer and transaction info using Get Charge Permission3. If ChargePermissionType is "OneTime", it indicates the buyer didn't consent to save the selected payment instrument for future purchases. You can use the ChargePermissionId for deferred payment authorization. See deferred transactions 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.
|
Error response:
Complete 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.“
Request
Request body
{
"chargeAmount": {
"amount": "14.00",
"currencyCode": "USD"
}
}
Note: If paymentIntent is Confirm, recurringMetadata is set and chargeAmount is not set for checkoutSession, then request body can be empty
Request parameters
Name
|
Location
|
Description
|
checkoutSessionId (required) Type: string |
Path parameter
|
Checkout Session identifier
|
chargeAmount Type: price |
Body
|
Amount to be processed using paymentIntent during checkout. Must match Checkout Session object paymentDetails.chargeAmount
|
totalOrderAmount Type: price |
Body
|
Total order amount. Must match Checkout Session object paymentDetails.totalOrderAmount if a value was provided
|
Response
{
"checkoutSessionId": "bd504926-f659-4ad7-a1a9-9a747aaf5275",
"webCheckoutDetails": null,
"chargePermissionType": PaymentMethodOnFile,
"recurringMetadata": null,
"paymentMethodOnFileMetadata": null,
"productType": null,
"paymentDetails": null,
"merchantMetadata": null,
"supplementaryData":null, // Amazon Pay system data
"buyer": null,
"billingAddress": null,
"paymentPreferences": [
null
],
"statusDetails": {
"state": "Completed",
"reasonCode": null,
"reasonDescription": null,
"lastUpdatedTimestamp": "20191015T204327Z"
},
"shippingAddress": null,
"platformId":null,
"chargePermissionId": "BA01-5105180-3221187",
"chargeId": null,
"constraints": [
null
],
"creationTimestamp": "20191015T204313Z",
"expirationTimestamp": null,
"storeId": null,
"deliverySpecifications": null,
"providerMetadata": null,
"releaseEnvironment": null
}
2. Add shipment tracking info
Note: This section is only applicable if you ship packages using a supported carrier.
Send shipment tracking information to Amazon Pay using the Delivery Tracker API. Amazon Pay will notify your buyers on their Alexa device when their package is shipped and when their package is delivered. See setting up delivery notifications for more info.