This API is used to reverse the money back to customers for previous successful transaction.
Refund transaction is called to reverse the money back to customers for transactions with payment status Settlement. If transaction's status is still Pending Authorize or Capture please use Cancel API instead. The same refund_id cannot be reused.
Refund transaction is supported only for credit_card , gopay, shopeepay , QRIS , and akulaku payment methods.
Refund request is made to Midtrans where Midtrans will then forward it to payment providers.
For QRIS with acquirers AirPay (Shopee) and ShopeePay, the maximum refund window is 24 hours. Airpay Shopee accepts refund only from 06:00 to 23:30 GMT+7.
While the maximum refund window for GoPay is as stated below:
- QRIS with acquirers GoPay: 45 days
- GoPay Tokenization and GoPay deeplink with GoPay payment option GOPAY_COINS: 90 days
- Other GoPay transactions: 180 days
Endpoints: /api/v1/core/{{transaction_id}}/refund/online/direct
HTTP Method: POST
Request Body
{
"refund_key": "reference1",
"amount": 5000,
"reason": "for some reason"
}| Field | Type | Attribute | Description |
|---|---|---|---|
| refund_key | String | Optional | Merchant refund ID. If not passed then Midtrans creates a new one. It is recommended to use this parameter to avoid double refund attempt. Allowed characters are alphabets, numbers, dash (-), and underscore (_). |
| amount | Long | Optional | Amount to be refunded. By default whole transaction amount is refunded. Note :Shopeepay does not support partial refund at the moment. |
| reason | String(255) | Optional | Reason justifying the refund. For GoPay & GoPay Tokenization payments, reason will be shown on customers' GoPay transaction history. Reason is mandatory for card payment with BNI as acquiring bank. If the value is not sent, Midtrans will autofill it with "refund request from merchant" to BNI. |
Response Body
{
"status_code": "200",
"status_message": "Success, refund request is approved",
"transaction_id": "447e846a-403e-47db-a5da-d7f3f06375d6",
"order_id": "vtcc05",
"payment_type": "credit_card",
"transaction_time": "2015-06-15 13:36:24",
"transaction_status": "refund",
"gross_amount": "10000.00",
"refund_chargeback_id": 1,
"refund_amount": "10000.00",
"refund_key": "reference1"
}{
"status_code": "200",
"status_message": "Success, refund request is approved",
"transaction_id": "447e846a-403e-47db-a5da-d7f3f06375d6",
"order_id": "vtcc05",
"payment_type": "credit_card",
"transaction_time": "2015-06-15 13:36:24",
"transaction_status": "partial_refund",
"gross_amount": "10000.00",
"refund_chargeback_id": 1,
"refund_amount": "5000.00",
"refund_key": "reference1"
}{
"status_code" : "412",
"status_message" : "Merchant cannot modify the status of the transaction"
}{
"status_code" : "414",
"status_message" : "Refund request is rejected due to invalid amount"
}{
"status_code" : "406",
"status_message" : "Duplicate refund ID"
}| Field | Type | Description |
|---|---|---|
| status_code | String | Status code of transaction refund result. |
| status_message | String | Description of transaction refund result. |
| transaction_id | String | Transaction ID given by Midtrans. |
| order_id | String | Order ID specified by you. |
| payment_type | String | The payment method used by the customer. |
| transaction_time | String | Timestamp of transaction in ISO 8601 format. Time Zone: GMT+7. |
| transaction_status | String | Transaction status after refund action. Possible values arerefund : Transaction is fully refunded. partial_refund: transaction is partially refunded. |
| gross_amount | String | Total amount of transaction in IDR. |
| refund_chargeback_id | String | Identification of the refund process. |
| refund_amount | String | Total amount to be refunded in IDR. |
| refund_key | String | Merchant refund reference key. |