Cancel Transaction

Cancel transaction is triggered to void the transaction. If transaction is already settled (status : settlement) you should perform refund instead if the payment method supports it.

Cancel API can be used in both Core API and Snap integrations.

Card Payment

Card payment can be voided with Cancel method if the transaction has not been settled. The time interval during which the pre-authorized transaction can be cancelled depends on the Acquiring Bank.

Acquiring BankTrigger Cancel Method
BNIAfter pre-authorization payment has been captured.
MandiriAfter the initial charge of the pre-authorized payment.
BCA, BRI, MAYBANKBefore and after pre-authorization payment has been captured.

Pending Payment

Payment with transaction_status:pending can be voided with cancel method if the transaction has not expired or has not been completed. The list of payment methods with transaction_status:pending are given below.

Cancel Transaction Method

See sample on the right -- try it yourself!

HTTP MethodEndpointDefinition
POSTBASE_URL/v2/{order_id OR transaction_id}/cancelCancel transaction

Cancel Transaction Response and Notification

  "status_code" : "200",
  "status_message" : "Success, transaction is canceled",
  "transaction_id" : "249fc620-6017-4540-af7c-5a1c25788f46",
  "masked_card" : "48111111-1114",
  "order_id" : "example-1424936368",
  "payment_type" : "credit_card",
  "transaction_time" : "2015-02-26 14:39:33",
  "transaction_status" : "cancel",
  "fraud_status" : "accept",
  "bank" : "bni",
  "gross_amount" : "30000.00"
  "status_code" : "412",
  "status_message" : "Merchant cannot modify the status of the transaction"
  "masked_card": "48111111-1114",
  "approval_code": "325511",
  "bank": "mandiri",
  "eci": "05",
  "transaction_time": "2016-07-04 13:32:44",
  "gross_amount": "244108.00",
  "order_id": "160288131764",
  "payment_type": "credit_card",
  "signature_key": "71f3b14d3036d2a60dac7fef1cdde7bebdbb2dbeebc68bcf5e7819fe8be7c9241611ea1e769e0c6775735805174c02b9d6b5cf89a11de1861d5efb298c9898b7",
  "status_code": "202",
  "transaction_id": "ffd82cd2-4f0d-4b24-b4b8-e201b0c3d80e",
  "transaction_status": "cancel",
  "fraud_status": "accept",
  "status_message": "midtrans payment notification"
JSON AttributeDescriptionType
status_codeStatus code of transaction cancel result.String
status_messageDescription of transaction cancel result.String
transaction_idTransaction ID given by Midtrans.String
masked_cardFirst 8-digits and last 4-digits of customer's credit card number.String
order_idOrder ID specified by you.String
payment_typeThe payment method used by the customer.String
transaction_timeTimestamp of transaction in ISO 8601 format. Time Zone: GMT+7.String
transaction_statusTransaction status after charge credit card transaction. Possible values are
capture : Transaction is accepted by the bank and ready for settlement.
Note: Cancel transaction to deny / cancel it. Otherwise, transaction is settled automatically.
deny: transaction is denied by the bank or FDS.
authorize: Credit card is authorized in pre-authorization feature.
fraud_statusDetection result by Fraud Detection System (FDS). Possible values are
accept : Approved by FDS.
deny: Denied by FDS. Transaction automatically failed.
bankThe acquiring bank of the transaction.String
gross_amountTotal amount of transaction in IDR.String
Click Try It! to start a request and see the response here!