To cancel an invoice you simply need to send a request to the endpoint below with the invoiceReference of the invoice to be canceled. 

This endpoint is protected with OAuth 2.0 Bearer token. To find out more about authorization for Monnify endpoints, check Here

Endpoint URL: {{base_url}}/api/v1/invoice/invoiceReference/cancel

HTTP Method: DELETE

The {{base_url}} for test is https://sandbox.monnify.com but when you go live, it changes to the live url

Once the invoice is canceled, the customer can no longer pay for that invoice. For the customer reserved invoice, the customer's account number becomes inactive.

Cancel Invoice Response
{
    "requestSuccessful": true,
    "responseMessage": "success",
    "responseCode": "0",
    "responseBody": {
        "amount": 1000.00,
        "invoiceReference": "test 1",
        "invoiceStatus": "CANCELLED",
        "description": "Test Invoice",
        "accountReference": "account-reference-7890-test-invoice",
        "contractCode": "4934121686",
        "customerEmail": "smekiliuwa@teamapt.com",
        "customerName": "Smart Mekiliuwa",
        "expiryDate": "2020-03-30 11:00:00",
        "createdBy": "MK_TEST_SAF7HR5F3F",
        "createdOn": "2020-02-18 13:19:46",
        "accountNumber": "4226988924",
        "bankName": "Providus Bank",
        "bankCode": "101"
    }
}

Webhook URL

Need help on how to implement your webhook URL? Click here


Field Reference

(M) indicates fields that are mandatory in the request body. (m) Indicates fields that are mandatory only if the parent object is not empty.

Field

Description

amount (M)

The amount to be paid by the customer

invoiceStatus

Status of the invoice. Can be either "PAID", "PENDING", "EXPIRED" or "CANCELLED"

currencyCode (M)

The currency of the transaction being initialized. "NGN"

invoiceReference (M)

Merchant's Unique reference for the invoice

customerName (M)

Full name of the customer

customerEmail (M)

The email address of the customer

apiKey (M)

Merchant's API Key (Can be found on the Monnify dashboard)

contractCode (M)

Merchant's contract code (Can be found on the Monnify dashboard)

description (M)

Description of the transaction. Will be used as the account name for bank transfer payments

expiryDate (M)

The expiry date for the invoice. After this date, the customer will no longer be able to pay for that invoice. The format is YYYY-MM-DD HH:MM:SS

checkoutUrl 

A URL which can be used to display the Monnify payment interface where the customer can then pay for the invoice via bank transfer or card. This is especially useful for card transactions as the account number can and SHOULD be displayed on the invoice directly.

accountNumber

The virtual account number generated for the invoice. This is the account number the customer can transfer to, to pay this invoice

accountName

The name that will be displayed to the customer when he performs name inquiry on the virtual account. Please note there may be Prefixes

bankName

The name of the bank where the virtual account number was generated. The customer will be expected to select this bank when doing the bank transfer

bankCode

The bank code of the bank where the virtual account number was generated

incomeSplitConfig 

The object containing specifications on how payments to this reserve account should be split.

subAccountCode (m)

The unique reference for the sub-account that should receive the split.

feeBearer

Boolean to determine if the sub-account should bear transaction fees or not

feePercentage

The percentage of the transaction fee to be borne by the sub-account

paymentMethods

The payment method which the customer will use to make the payments. This can be set as "ACCOUNT_TRANSFER" or "CARD" . If not set, this would default to the enabled methods in the contract detail.

splitPercentage

The percentage of the amount paid to be split into the sub-account. 

redirectUrl

A URL which customer will be redirected to when payment is successfully completed on the Web SDK.


Related Articles