Use Sandbox simulations
Use Sandbox simulations to test your integration before going live. You can simulate different checkout scenarios such as payment declines and cart abandonment by selecting specific simulated payment methods during Sandbox checkout. You can also intentionally trigger different API responses by adding simulation strings to your request header.
Note: if you use both simulated payment methods and simulation strings during the same checkout, simulation strings will override any behavior triggered by using a simulated payment method.
Using simulated payment methods
Sandbox test buyer accounts come pre-configured with simulated payment methods. Select a payment method marked with * during Sandbox checkout to simulate a specific payment scenario. You will get an error if the simulation prerequisite has not been met.
Card number
|
Payment scenario
|
Prerequisite
|
...1111 ...0005 ...4444 ...9424 ...0000 |
Happy case. On the checkoutResultReturnUrl page you will get: Charge in Authorized state if paymentIntent was set to AuthorizeChargePermission in Chargeable state if paymentIntent was set to Confirm
|
-
|
...3064
|
Checkout Session in Canceled state with BuyerCanceled reason code after the buyer returns to checkoutResultReturnUrl
|
-
|
...3434
|
Checkout Session in Canceled state with Declined reason code after the buyer returns to checkoutResultReturnUrl
|
-
|
...0701
|
Charge will be in AuthorizeInitiated state after the buyer returns to checkoutResultReturnUrl . It will move to Authorized state after 30 seconds based on paymentIntent
|
You must set paymentIntent to Authorize, and canHandlePendingAuthorization to true on the Checkout Session or using this payment method will result in an error |
...4354
|
Charge will be in AuthorizeInitiated state, when checkoutResultReturnUrl is visited. It will move to Declined state after 30 seconds with reason code HardDeclined
|
You must set paymentIntent to Authorize, and canHandlePendingAuthorization to true on the Checkout Session or using this payment method will result in an error |
Using simulation strings
Add x-amz-pay-simulation-code
request header to your API calls to simulate different behaviors. For example, “x-amz-pay-simulation-code = ”BuyerCanceled”. Note that you should not include x-amz-pay-simulation-code
request header in the header signature.
Checkout Session
State
|
Reason code
|
Simulation code
|
How to simulate
|
Open
|
-
|
-
|
Create Checkout Session
|
Completed
|
-
|
-
|
Redirect Buyer to amazonPayRedirectUrl
|
Canceled
|
Expired
|
-
|
Checkout Session will expire after 24 hours in Open state
|
Canceled
|
BuyerCanceled
|
BuyerCanceled
|
Specify the simulation code in the header of Get Checkout Session or Update Checkout Session and redirect the buyer to amazonPayRedirectUrl Note that simulation codes are not persisted. You must set the simulation code in the request, immediately preceding the redirect |
Canceled
|
AmazonCanceled
|
AmazonCanceled
|
Specify the simulation code in the header of Get Checkout Session, or Update Checkout Session and redirect the buyer to amazonPayRedirectUrl Note that simulation codes are not persisted. You must set the simulation code in the request, immediately preceding the redirect |
Canceled
|
Declined
|
Declined
|
Specify the simulation code in the header of Get Checkout Session or Update Checkout Session, and redirect the buyer to amazonPayRedirectUrl Note that simulation codes are not persisted. You must set the simulation code in the request immediately preceding the redirect |
Charge
State
|
Reason code
|
Simulation code
|
How to simulate
|
AuthorizationInitiated
|
-
|
AuthorizationInitiated
|
Specify the simulation code in the header of Get Checkout Session, or Update Checkout Session with set to true. Redirect the buyer to amazonPayRedirectUrl Charge will be in the AuthorizationInitiated state for 30 seconds, and then move to Authorized or Captured state, based on PaymentIntent Note that simulation codes are not persisted. You must set the simulation code in the request, immediately preceding the redirect |
Authorized
|
-
|
-
|
Update Checkout Session with paymentIntent set to Authorize. Redirect the buyer to amazonPayRedirectUrl
|
Authorized
|
-
|
AuthorizationInitiated
|
Specify the simulation code in the header of Get Checkout Session, or Update Checkout Session with set to true, and paymentIntent set to Authorize. Redirect the buyer to amazonPayRedirectUrl Charge will be in the AuthorizationInitiated state for 30 seconds, and then move to Authorized Note that simulation codes are not persisted. You must set the simulation code in the request, immediately preceding the redirect |
Authorized
|
-
|
-
|
Create Charge with canHandlePendingAuthorization set to false, and captureNow set to false
|
Captured
|
-
|
-
|
Create Charge with canHandlePendingAuthorization set to false, and captureNow set to true
|
CaptureInitiated
|
-
|
CaptureInitiated
|
Specify the simulation code in the header of Capture Charge will be in CaptureInitiated state for 30 seconds, and then it will move to Captured state |
Declined
|
SoftDeclined
|
PendingSoftDeclined
|
Specify the simulation code in the header of Get Checkout Session, Create Charge, or Update Checkout Session with canHandlePendingAuthorization set to true. Redirect the buyer to amazonPayRedirectUrl Charge will be in the AuthorizationInitiated state for 30 seconds, and then move to Declined state with reason code SoftDeclined Note that simulation codes are not persisted. You must set the simulation code in the request, immediately preceding the redirect |
Declined
|
HardDeclined
|
PendingHardDeclined
|
Specify the simulation code in the header of Get Checkout Session, or Update Checkout Session with canHandlePendingAuthorization set to true. Redirect the buyer to amazonPayRedirectUrl Charge will be in the AuthorizationInitiated state for 30 seconds, and then move to Declined state with reason code HardDeclined Note that simulation codes are not persisted. You must set the simulation code in the request, immediately preceding the redirect |
Declined
|
AmazonRejected
|
PendingAmazonRejected
|
Specify the simulation code in the header of Get Checkout Session, or Update Checkout Session with canHandlePendingAuthorization set to true. Redirect the buyer to amazonPayRedirectUrl Charge will be in the AuthorizationInitiated state for 30 seconds, and then move to Declined state with reason code AmazonRejected Note that simulation codes are not persisted. You must set the simulation code in the request, immediately preceding the redirect |
Declined
|
AmazonRejected
|
AmazonRejected
|
Specify the simulation code in the header of Create Charge or Capture Charge will be in CaptureInitiated state for 30 seconds, and then it will move to Declined state |
Declined
|
SoftDeclined
|
SoftDeclined
|
Specify the simulation code in the header of Create Charge
|
Declined
|
HardDeclined
|
HardDeclined
|
Specify the simulation code in the header of Create Charge
|
Declined
|
TransactionTimedOut
|
TransactionTimedOut
|
Specify the simulation code in the header of Create Charge
|
Canceled
|
MerchantCanceled
|
-
|
Cancel Charge
|
Charge Permission
State
|
Reason code
|
Simulation code
|
How to simulate
|
Chargeable
|
-
|
-
|
Complete checkout with a valid card
|
Closed
|
MerchantClosed
|
-
|
Cancel Charge Permission
|
Closed
|
AmazonClosed
|
AmazonClosed
|
Specify the simulation code in the header of Cancel Charge Permission. `CancelPendingCharges` must be set to false
|
Refund
State
|
Reason code
|
Simulation code
|
How to simulate
|
RefundInitiated
|
-
|
-
|
Create Refund. Refund will be in the RefundInitiated state for 30 seconds before moving to Refunded state
|
Refunded
|
-
|
-
|
Create Refund. Refund will be in the RefundInitiated state for 30 seconds before moving to Refunded state
|
Declined
|
AmazonRejected
|
AmazonRejected
|
Specify the simulation code in the header of Create Refund
|