Create Refund
Introduction
If amount
, currency
is not passed, a full refund will be made, otherwise, a partial refund will be made according to the passed value.
Interface
POST /v1/refunds
Request Params
Field | Name | Type | Range | Example | Default | Optional | Remark | Rule |
---|---|---|---|---|---|---|---|---|
reference | Reference | string | [1, 64] | 2022123 | optional | Refer to merchant side's customer ID, see Unique Reference Mode | ||
payment_id | Payment ID | string | [1,64] | required | ||||
currency | Currency | string | [1,64] | optional | ||||
amount | Amount | string | [1,64] | optional | ||||
description | Description | string | optional | |||||
metadata | Metadata | hash | optional | |||||
extra | Extra | hash | optional |
extra
For boleto_br:
Extra Field | Remark |
---|---|
country | required |
currency | required |
bank_name | required |
bank_code | required |
bank_branch_name | optional |
bank_branch_code | required |
account_type | required |
account_holder_name | required |
account_number | required |
reference | optional |
For paycash_mx:
Value | Remark |
---|---|
country | required |
currency | required |
bank_name | optional |
bank_code | required |
bank_branch_name | optional |
bank_branch_code | required |
account_type | required |
account_holder_name | required |
account_number | required |
reference | optional |
Response Example
200 success:
{
"id": "rfd_SKCW50iHOG4C9i54uPrTqTa",
"object": "refund",
"livemode": true,
"payment_id": "pm_KG4Sq1zDCer5uTq1GGXjLKGO",
"payment_method": "alipay_cn",
"time_created": "2023-01-09T13:50:17+08:00",
"time_refunded": "2023-01-09T13:50:20+08:00",
"reference": null,
"payment_reference": null,
"currency": "CNY",
"currency_local": "CNY",
"amount": "0.05",
"amount_local": "0.05",
"failure_message": null,
"failure_code": null,
"gateway_transaction_id": null,
"succeeded": true,
"status": "refunded",
"description": null,
"metadata": {
"custom_field": "custom_value"
},
"extra": {}
}
400 error:
{
"error": {
"type": "invalid_request_error",
"message": "Cannot refund as it has been fully refunded. Payment id: pm_eD0SGKHGqvP0Gyj1q1L0KmPK."
}
}