Endpoints: /v1/invoices/{invoice_id}
HTTP Method: PATCH
Headers:
Production: https://api.midtrans.com/v1/invoices/{invoice_id}/void
Sandbox: https://api.sandbox.midtrans.com/v1/invoices/{invoice_id}/void
| Key | Description |
|---|---|
| Authorization | Basic Base64Encode(merchantServerKey:) |
EligibilityOnly invoices with PENDING and OVERDUE status can be voided. For quotations, only PUBLISHED quotations can be voided.
Request Example
Without cancel_as:
curl --location --request PATCH 'https://api.midtrans.com/v1/invoices/{invoice_id}/void' \
--header 'Authorization: Basic Base64Encode(merchantServerKey:)'
With cancel_as:
curl --location --request PATCH 'https://api.midtrans.com/v1/invoices/{invoice_id}/void' \
--header 'Authorization: Basic Base64Encode(merchantServerKey:)' \
--header 'Content-Type: application/json' \
--data '{
"cancel_as": "client"
}'
Body Parameter
| Parameter | Description |
|---|---|
| cancel_as Optional | Specifies the cancellation mode used when voiding a quotation: providing client sets the status to REJECTED, while leaving it null, empty, or providing any other value sets the status to CANCELLED(note: this parameter is applicable only to Quotations and cannot be used for Invoices). |
Response
{
"success": true
}
{
"error_messages": [
"Not Found"
]
}
{
"error_messages": [
"Invoice cannot be canceled"
]
}
{
"error_messages": [
"Internal server error"
]
}