Refund for a transaction
The refund API is asynchronous processing. After merchant call refund API, merchant need call query refund API for check refund status of refund transaction.
- application/json
- application/x-www-form-urlencoded
Request Body required
- app_id integer required
This is a Zalopay-provided identifier specific to the merchant's service or application, established during the integration agreement for payment methods.
- m_refund_id string required
Merchant must be generate merchant own transaction code when submit refund requirement (TXID of refund transaction).
Must be preceded by yymmdd of the current date. The transaction-code's format should be yymmdd_appid_refund identifier.
Merchant uses this field to query refund's transaction status. - zp_trans_id string required
Transaction code, which want to be refund. Transaction code of Zalopay, retrieved from callback data or merchant call get order's status API.
- amount int64 required
Refund amount for users.
- refund_fee_amount int64
The fee of the refund transaction, which will be deducted from the amount that the buyer receives back from the refund transaction. Can be safely omitted in the request if you do not need this feature.
- timestamp int64 required
Time to refund (unix timestamp in millisecond). The time of making the refund, is calculated in milliseconds,
- description string required
Reason for refunding.
- mac string required
Authentication information mac = HMAC(hmac_algorihtm, mac key, hmacinput), see as below:
- hmac_algorihtm: is a security method registered by Merchant with Zalopay, the default is HmacSHA256.
- mac key: provided by Zalopay at registration.
- hmacinput:+ No refund fee, hmacinput = app_id +
|
+ zp_trans_id +|
+ amount +|
+ description +|
+ timestamp
+ Have refund fee (refund_fee_amount), hmacinput = app_id +|
+ zp_trans_id +|
+ amount +|
+ refund_fee_amount +|
+ description +|
+ timestampPlease refer to secure data transmission for detailed information.
Request Body required
- app_id integer required
This is a Zalopay-provided identifier specific to the merchant's service or application, established during the integration agreement for payment methods.
- m_refund_id string required
Merchant must be generate merchant own transaction code when submit refund requirement (TXID of refund transaction).
Must be preceded by yymmdd of the current date. The transaction-code's format should be yymmdd_appid_refund identifier.
Merchant uses this field to query refund's transaction status. - zp_trans_id string required
Transaction code, which want to be refund. Transaction code of Zalopay, retrieved from callback data or merchant call get order's status API.
- amount int64 required
Refund amount for users.
- refund_fee_amount int64
The fee of the refund transaction, which will be deducted from the amount that the buyer receives back from the refund transaction. Can be safely omitted in the request if you do not need this feature.
- timestamp int64 required
Time to refund (unix timestamp in millisecond). The time of making the refund, is calculated in milliseconds,
- description string required
Reason for refunding.
- mac string required
Authentication information mac = HMAC(hmac_algorihtm, mac key, hmacinput), see as below:
- hmac_algorihtm: is a security method registered by Merchant with Zalopay, the default is HmacSHA256.
- mac key: provided by Zalopay at registration.
- hmacinput:+ No refund fee, hmacinput = app_id +
|
+ zp_trans_id +|
+ amount +|
+ description +|
+ timestamp
+ Have refund fee (refund_fee_amount), hmacinput = app_id +|
+ zp_trans_id +|
+ amount +|
+ refund_fee_amount +|
+ description +|
+ timestampPlease refer to secure data transmission for detailed information.
- 200
OK
- application/json
- Schema
- Example (from schema)
Schema
- return_code integer
Status code.
Please refer to status code for possible values - return_message string
Description of status code.
- sub_return_code integer
Status code detail.
Please refer to sub status code for possible values - sub_return_message string
Description of status code detail.
- refund_id int64
Zalopay refund's transaction code. Merchant needs to store this field for cross-check then.
{
"return_code": 0,
"return_message": "string",
"sub_return_code": 0,
"sub_return_message": "string",
"refund_id": 0
}