Post Charge API
Method: POST
Path: https://amazonpay.amazon.in/v1/payments/charge
ContentType: application/json
Description: This API initiates a transaction by triggering a 'Capture' intent. If the user has sufficient balance, the amount will be instantly deducted. If the balance is insufficient, a payment URL will be provided for the user to complete the payment.
Request Parameters
| Parameter Name | Data Type | Description | Mandatory | Constraints |
|---|---|---|---|---|
| intent | String | Charge request type | Yes | Allowed value: "Capture" |
| amount | String | Total Order Amount | Yes | Minimum value = 0.01 |
| currencyCode | String | Currency of the order | Yes | Allowed Value: "INR" |
| callbackUrl | String | A static, Amazon Pay safelisted URL. For app transactions, refer to the callbackURL for Apps section. | Yes | |
| accessToken | String | Fetched for the user using Access Token API | Yes | |
| chargeId | String | Unique charge ID generated by the merchant | Yes | Max: 50 characters - Alphanumeric Allowed characters: lowercase a-z uppercase A-Z numbers 0-9 dash (-) underscore (_) |
| referenceId | String | Unique ID tagging multiple transactions together | Yes | |
| merchantId | String | Merchant ID provided by Amazon | Yes | Unique ID provided by Amazon |
| attributableProgram | String | This is a constant value | Yes | Allowed value: "S2Spay" |
| noteToCustomer | String | Optional notes to the customers | No | Max 200 characters |
| customData | String | This is the merchant store Id provided by Amazon against an MID | No | Max 2000 characters |
| timeoutInSecs | String | Transaction expiry timestamp | Yes | Allowed Values: Min Value - 300 secs Max value - 900 secs |
| paymentMetaData | String | The value returned by the amazonPayTransactionMetadataRequest method from the client-side SDK | Yes | Required only for transactions made via the Android app |
| selectedPaymentInstrumentType | String | This is a constant value | Yes | Allowed value: "AmazonPayLater" |
Sample JSON for Request
{
"intent": "Capture",
"merchantId": "A28RUGPVUTQXU1",
"chargeId": "ve7v676dsdsde7f",
"accessToken": "A3RYF1HD1W5QCF",
"referenceId": "ve7vdsdsde7f",
"amount": "0.01",
"currencyCode": "INR",
"attributableProgram": "S2SPay",
"callbackUrl": "http://merchantx.com/pay",
"noteToCustomer": "note to customer",
"customData": "data",
"timeoutInSecs": "90000"
}
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| merchantId | String | Your merchant ID with Amazon Pay |
| requestedAmount | String | Amount requested as part of the request |
| approvedAmount | String | Approved amount from Amazon Pay |
| amazonChargeId | String | Amazon generated unique transaction Id |
| chargeId | String | Merchant transaction ID sent in the request |
| status | String | Indicates the status of the request |
| currencyCode | String | Will always be INR |
| amazonPayUrl | String | URL for redirection if user balance is low |
| customData | String | Additional data passed in the request |
| createTime | String | Creation timestamp |
| updateTime | String | Last update timestamp |
| attributableProgram | String | You must pass it as S2Spay |
| customData | String | (Optional) Will be part of the response only if the parameter was passed in the request createTime String |
| createTime | String | When the request was created at our end |
Sample Response
{
"merchantId": "A28RUGPVUTQXU1",
"chargeId": "ve7vdsd99sde7f",
"amazonChargeId": "P04-0249917-0735882",
"requestedAmount": "0.01",
"approvedAmount": "0.01",
"currencyCode": "INR",
"status": "CaptureApproved",
"amazonPayUrl": "https://amazonpay.amazon.in/~",
"customData": "data passed in the request",
"createTime": "2020-01-13T05:28:30.377Z",
"updateTime": "2020-01-13T05:28:30.377Z"
}
Common Errors
| Error | Resolution |
|---|---|
| InvalidAccessToken | This error indicates that the access token has turned stale and is no longer valid or doesn't have the right permissions. Access tokens turn stale 60 minutes after they are requested. To resolve, request a new access token. |
| InvalidCallbackUrl | Ensure that your callback URL used in the API request is added to the list of approved URLs at Amazon. If they are not on the list of approved URLs, reach out to your integration POC to get them added to the list. |
| Transaction has timed out | The default timeout value for transactions is set to 15 minutes. Ensure that the time out value is not set to less than 5 minutes to avoid transaction timeout. |