Refund API

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"
}
FieldTypeAttributeDescription
refund_keyStringOptionalMerchant 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 (_).
amountLongOptionalAmount to be refunded. By default whole transaction amount is refunded. Note :
Shopeepay does not support partial refund at the moment.
reasonString(255)OptionalReason 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"
}
FieldTypeDescription
status_codeStringStatus code of transaction refund result.
status_messageStringDescription of transaction refund result.
transaction_idStringTransaction ID given by Midtrans.
order_idStringOrder ID specified by you.
payment_typeStringThe payment method used by the customer.
transaction_timeStringTimestamp of transaction in ISO 8601 format. Time Zone: GMT+7.
transaction_statusStringTransaction status after refund action. Possible values are
refund : Transaction is fully refunded.
partial_refund: transaction is partially refunded.
gross_amountStringTotal amount of transaction in IDR.
refund_chargeback_idStringIdentification of the refund process.
refund_amountStringTotal amount to be refunded in IDR.
refund_keyStringMerchant refund reference key.