Manage deferred transactions
You can choose to defer authorizing or capturing payment until after checkout. For example, you might choose to only authorize payment after a back-ordered item becomes available (deferred authorization), or capture payment after an order is shipped (deferred capture).
Deferred authorizations
Prerequisite: You must have a ChargePermissionId
for a Charge Permission in the Chargeable state. A Charge Permission is created at the end of a successful checkout after the buyer has returned to the checkoutResultReturnUrl
.
Create Charge to authorize a payment. You can specify whether or not you want to capture payment in the same transaction. If the request fails, you should reengage the buyer and ask them to go through checkout again.
Request
curl "https://pay-api.amazon.com/:environment/:version/charges/" \
-X POST
-H "x-amz-pay-idempotency-key: AVLo5tI10BHgEk2jEXAMPLEKEY"
-H "x-amz-pay-authorization: Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"
-d @request_body
Request body
{
"chargePermissionId": "P21-1111111-1111111",
"chargeAmount": {
"amount": "14.00",
"currencyCode": "USD"
},
"captureNow": true, // default is false
"softDescriptor": "Descriptor",
"canHandlePendingAuthorization": false //default is false
}
Request parameters
Name
|
Location
|
Description
|
x-amz-pay-idempotency-key (required) Type: string |
Header
|
Idempotency key to safely retry requests
|
chargePermissionId (required) Type: string |
Body
|
Charge Permission identifier
|
chargeAmount (required) Type: price |
Body
|
Transaction amount
|
captureNow Type: boolean |
Body
|
Boolean that indicates whether or not Charge should be captured immediately after a successful authorization Default: false |
softDescriptor Type: string |
Body
|
Description shown on the buyer payment instrument statement, if CaptureNow is set to true. Do not set this value if CaptureNow is set to falseThe soft descriptor sent to the payment processor is: "AMZ* <soft descriptor specified here>" Max length: 16 characters |
canHandlePendingAuthorization Type: boolean |
Body
|
Boolean that indicates whether or not merchant can handle pending response See asynchronous processing for more info |
providerMetadata Type: providerMetadata |
Body
|
Payment service provider (PSP)-provided order details Only PSPs should use these fields |
Response
{
"chargeId": "P21-1111111-1111111-C111111",
"chargePermissionId": "P21-1111111-1111111",
"chargeAmount": {
"amount": "14.00",
"currencyCode": "USD"
},
"captureAmount": {
"amount": "14.00",
"currencyCode": "USD"
},
"refundedAmount": {
"amount": "0.00",
"currencyCode": "USD"
},
"convertedAmount": "14.00",
"conversionRate": "1.00",
"softDescriptor": "Descriptor",
"providerMetadata": {
"providerReferenceId": null
},
"statusDetail": {
"state": "Captured",
"reasonCode":null,
"reasonDescription": null,
"lastUpdatedTimestamp": "20190714T155300Z"
},
"creationTimestamp": "20190714T155300Z",
"expirationTimestamp": "20190715T155300Z"
}
Deferred captures
Prerequisite: You must have a ChargeId
for a Charge object in the Authorized state. A Charge is created each time you attempt to charge the buyer.
Charge State
|
Description
|
Within 7 days
|
Capture request is processed synchronously. Charge will be in a Captured state, see Charge state explanation below for more info.
|
After 7 days
|
Capture request is processed asynchronously. Charge will be in a CaptureInitiated state, see Charge state explanation below for more info.
|
After 30 days
|
Charge has expired after 30 days in Authorized state. Charge is in a Canceled state and you can no longer capture funds using this Charge Attempt to create a new Charge if Charge Permission is in a Chargeable state. Otherwise, contact the buyer to have them checkout again or set up an alternative form of payment |
Charge state explanation
Charge State
|
Description
|
AuthorizationInitiated
|
Authorization is pending. See Asynchronous processing section for more info.
|
Authorized
|
Payment was successfully authorized. See Deferred transactions for more info.
|
CaptureInitiated
|
Payment was successfully authorized and capture is pending. See Asynchronous processing section for more info.
|
Captured
|
Payment was successfully authorized and captured
|
Declined
|
Payment was declined. See Charge declined state reason code for more info. You should reengage the buyer and ask them to go through checkout again. |
Request
curl "https://pay-api.amazon.com/:environment/:version/charges/:chargeId/capture" \
-X POST
-H "x-amz-pay-idempotency-key: AVLo5tI10BHgEk2jEXAMPLEKEY"
-H "x-amz-pay-authorization: Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"
-d @request_body
Request body
{
"captureAmount": {
"amount": "14.00",
"currencyCode": "USD"
},
"softDescriptor": "Descriptor"
}
Request parameters
Name
|
Location
|
Description
|
x-amz-pay-idempotency-key (required) Type: string |
Header
|
Idempotency key to safely retry requests
|
chargeId (required) Type: string |
Path Parameter
|
Charge identifier
|
captureAmount (required) Type: price |
Body
|
Amount to capture
|
softDescriptor Type: string |
Body
|
Description shown on the buyer's payment instrument statement The soft descriptor sent to the payment processor is: "AMZ* <soft descriptor specified here>" Max length: 16 characters |
Response
{
"chargeId": "P21-1111111-1111111-C111111",
"chargePermissionId": "P21-1111111-1111111",
"chargeAmount": {
"amount": "14.00",
"currencyCode": "USD"
},
"captureAmount": {
"amount": "14.00",
"currencyCode": "USD"
},
"refundedAmount": {
"amount": "0.00",
"currencyCode": "USD"
},
"convertedAmount": "14.00",
"conversionRate": "1.00",
"softDescriptor": "Descriptor",
"providerMetadata": {
"providerReferenceId": null
},
"statusDetail":{
"state": "Captured",
"reasonCode": null,
"reasonDescription": null,
"lastUpdatedTimestamp": "20190714T155300Z"
},
"creationTimestamp": "20190714T155300Z",
"expirationTimestamp": "20190715T155300Z"
}