Refund API
Method: POST
Path: https://<endpoint>/v1/payments/refund
ContentType: application/json
Description: This API enables the refund of a transaction based on the value passed in the request.
Request Parameters
| Parameter | Type | Description |
|---|---|---|
| Amount | String | Amount to be refunded for the order |
| currencyCode | String | Will always be INR |
| refundId | String | Merchant-generated unique identifier for each refund request |
| chargeIdType | String | Possible values - AmazonTxnId and MerchantTxnId |
| chargeId | String | Appropriate id based on the type passed in the above field |
| merchantId | String | Your merchant ID with Amazon Pay |
| noteToCustomer | String | Optional notes to the customers |
| softDescriptor | String | Reason for the refund |
Sample JSON for Request
{
"merchantId": "A2UOYLUXLC6NR3",
"refundId": "M04-3581290-6586191",
"chargeIdType": "AmazonTxnId",
"chargeId": "P04-0249917-0735882",
"amount": "2.00",
"currencyCode": "INR",
"noteToCustomer": "string",
"softDescriptor": "string"
}
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| refundId | String | Unique id generated for the refund request |
| amazonRefundId | String | Amazon-generated identifier for the refund transaction |
| amount | String | Amount requested to be refunded |
| refundedFee | String | The capture fee that has been refunded |
| currencyCode | String | Will always be INR |
| status | String | Transaction status (Approved, Pending, Declined) |
| createTime | String | Creation timestamp |
| updateTime | String | Last update timestamp |
Sample Response
Success
HTTP 201 OK
{
"refundId": "ve7vdsd99sde7f",
"amazonRefundId": "P04-0249917-0735882-R8908908",
"amount": 0.01,
"refundedFee": 0.01,
"currencyCode": "INR",
"status": "Approved/Pending/Declined",
"createTime": "2020-01-18T11:11:41.511Z",
"updateTime": "2020-01-18T11:12:52.661Z"
}
Error
HTTP 400 InvalidArguments
Common Errors
| Error | Resolution |
|---|---|
| Invalid refundId | Please pass a valid refundId based on the constraints specified. |
| Transient error in API response | If you encounter any transient error, please try the API call again after 30 minutes to one hour. |
For more errors, refer to this.