Refund Transaction
Path
- URL:
/cb-core/api/v1/transaction/refund - Method:
POST - Description: This API allows to create request to refund a transaction
Request
Request Table
| Params | Data Type + Length | Required | Description |
|---|---|---|---|
| request_id | string(50) | Yes | Unique request ID, suggested format: MerchantCode+YYYYMMDDHHMMSS+UniqueId |
| request_time | string(19) | Yes | Request time in format: YYYY-MM-DD HH:MM:SS |
| merchant_code | string(20) | Yes | Merchant code provided by Baokim before integration |
| sub_merchant_code | string(50) | Yes | If the Seller is under your sub-merchant, fill your sub merchant code provided by Baokim. If Seller is under you, fill your Merchant_code provided by Baokim as above |
| seller_id | string(50) | Yes | Seller ID matching the Onboarding Sellers API |
| refunded_transaction_id | string(50) | Yes | Fill Baokim's transaction ID which merchant wants to make refund |
| refund_reference_id | string(50) | Yes | The reference code of the refund managed in your system. This code is unique. |
| refund_type | int(1) | Yes | 1: Full refund, 2: Partial refund. Default = 1 |
| amount | decimal(12,2) | Yes | Amount of the order |
| fee_payer | int(1) | Yes | 1: Merchant, 2: User. Default = 1 |
| reason | string(255) | Yes | Reason for refund |
Request Example
{
"request_id": "MERCHANT12345678901234510281",
"request_time": "2024-11-15 14:36:00",
"merchant_code": "PHUONGTT",
"sub_merchant_code": "SUBPHUONGTT",
"seller_id": "SELLER12345678901234510281",
"refunded_transaction_id": "1234567892",
"refund_reference_id": "TT1234567890",
"amount": "1000000.00",
"refund_type": 1,
"fee_payer": 1,
"reason": "Customer requested a refund"
}
Response
Response Table
| Params | Data Type + Length | Required | Description |
|---|---|---|---|
| response_code | int(4) | Yes | Error code from Baokim as per Error Codes Table |
| response_message | string(100) | Yes | Description of the error code from Baokim as per Error Codes Table |
| data | object | Yes | Data of the response |
| data.merchant_code | string(20) | Yes | Merchant code provided by Baokim before integration |
| data.sub_merchant_code | string(20) | Yes | Sub merchant code provided by Baokim before integration |
| data.refund_reference_id | string(50) | Yes | The reference code of refund managed in your system. This code is unique |
| data.refund_transaction_id | string(50) | Yes | The refund transaction id from Baokim |
| data.refunded_transaction_id | string(50) | Yes | Baokim's transaction ID which merchant wants to make refund |
| data.refund_status | int(1) | Yes | The refund status. 1. Success, 2. Failed, 3. Pending |
| data.refund_type | int(1) | Yes | 1: Full refund, 2: Partial refund. Default = 1 |
| data.request_amount | decimal(12,2) | Yes | Request amount |
| data.refund_fee | decimal(12,2) | Yes | Fee of refund |
| data.fee_payer | int(1) | Yes | 1: Merchant, 2: User. Default = 1 |
| data.refund_amount | decimal(12,2) | Yes | Refund amount |
| data.reason | string(255) | Yes | Reason for refund |
Response Example
{
"response_code": 200,
"response_message": "Success",
"data": {
"merchant_code": "PHUONGTT",
"sub_merchant_code": "SUBPHUONGTT",
"seller_id": "SELLER12345678901234510281",
"refund_reference_id" : "TT1234567890",
"refund_transaction_id": "1234567893",
"refunded_transaction_id": "1234567892",
"refund_status": 1,
"refund_type": 1,
"refund_amount": "1000000.00",
"request_amount": "1000000.00",
"fee_payer": 1,
"refund_fee": "0.00",
"reason": "Customer requested a refund"
}
}
Error Code
| Response Code | Response Message |
|---|---|
| 200 | Success |
| 99 | Pending |
| 11 | Failed |
| 101 | System Error |
| 110 | Merchant Code Invalid |
| 120 | Invalid Signature |
| 422 | Validation Error |