# Initiate Refund
The merchant's business system initiates a refund request through the Unified Refund API, and the payment gateway will find the corresponding payment channel to initiate a refund based on the payment order number initiated by the merchant.
# Initiate Refund API
api
Request API: /api/refund/refundOrder
Request method: POST
Request type: application/json or application/x-www-form-urlencoded
# Request parameters
| Field Name | Variable Name | Required | Type | Example Value | Description |
|---|---|---|---|---|---|
| Merchant No | mchNo | Yes | String(30) | M1621873433953 | Merchant Number |
| App ID | appId | Yes | String(24) | 60cc09bce4b0f1c0b83761c9 | App ID |
| Payment Order No | payOrderId | Yes | String(30) | P20160427210604000490 | The order number generated by the payment center can be passed along with mchOrderNo |
| Merchant Order No | mchOrderNo | Yes | String(30) | 20160427210604000490 | The payment order number generated by the merchant can be passed along with payOrderId |
| Merchant Refund Order No | mchRefundNo | Yes | String(30) | M27210632100491 | Merchant generated refund order number |
| Refund amount | refundAmount | Yes | int | 100 | Refund amount, in cents |
| Currency Code | currency | No | String(3) | USD | Three-digit currency code |
| Refund Reason | refundReason | Yes | String(64) | User returns | Reason for refund |
| Client IP | clientIp | No | String(32) | 210.73.10.148 | Client IP address |
| Asynchronous notification address | notifyUrl | No | String(128) | https://pay.enjoy.link/notify.htm | This URL will be called back after the refund is completed. Only when this value is passed will the callback be initiated |
| Extended Parameters | extParam | No | String(512) | 134586944573118714 | Merchant extended parameters, which will be returned unchanged during callback |
| Request Time | reqTime | Yes | long | 1622016572190 | Request API time, 13-digit timestamp |
| API Version | version | Yes | String(3) | 1.0 | API version number, fixed: 1.0 |
| Signature | sign | Yes | String(32) | C380BEC2BFD727A4B6845133519F3AD6 | Signature value, see signature algorithm for details |
| Signature type | signType | Yes | String(32) | MD5 | Signature type, currently only supports MD5 mode |
# Request Example Data
{
"payOrderId": "P202106181104177050002",
"extParam": "",
"mchOrderNo": "",
"refundReason": "Refund Test",
"sign": "2762CDB48D5179281DB6C0995E4EEDE0",
"reqTime": "1624007315",
"version": "1.0",
"appId": "60cc09bce4b0f1c0b83761c9",
"mchRefundNo": "mho1624007315478",
"clientIp": "192.166.1.132",
"notifyUrl": "https://pay.enjoy.link/notify.htm",
"signType": "MD5",
"currency": "USD",
"mchNo": "M1623984572",
"refundAmount": 4
}
# Return parameters
| Field Name | Variable Name | Required | Type | Example Value | Description |
|---|---|---|---|---|---|
| Return State | code | Yes | int | 0 | 0 - processing successful, others - processing error, see error code for details |
| Return Message | msg | No | String(128) | Signature failure | Specific error reasons, such as: signature failure, parameter format verification error |
| Signature | sign | No | String(32) | CCD9083A6DAD9A2DA9F668C3D4517A84 | Sign the data in data, if data is empty, it will not be returned |
| Return Data | data | No | String(512) | {} | Return order data, json format data |
# Parameter Data Format
| Field Name | Variable Name | Required | Type | Example Value | Description |
|---|---|---|---|---|---|
| Refund Order No | refundOrderId | Yes | String(30) | R202106181708358940000 | Return refund order number |
| Merchant Refund Order No | mchRefundNo | Yes | String(30) | mho1624007315478 | Returns the refund order number passed in by the merchant |
| Refund State | state | Yes | int | 2 | Refund status 0-Order generated 1-Refund in progress 2-Refund successful 3-Refund failed 4-Refund closed |
| Channel Error Code | errCode | No | String | PAYMENT_AUTH_CODE_INVALID | Error code returned by the upstream channel |
| Channel Error Message | errMsg | No | String | Business Failed failed | Error description returned by the upstream channel |
# Return Example Data
{
"code": 0,
"data": {
"channelOrderNo": "2021061822001423031419593035",
"mchRefundNo": "mho1624007315478",
"payAmount": "58",
"refundAmount": "4",
"refundOrderId": "R202106181708358940000",
"state": 2
},
"msg": "SUCCESS",
"sign": "2843B811B7A75D56B7D1950362820875"
}