Cancel an Invoice

You can cancel an unpaid invoice. Partially paid or fully paid invoices cannot be cancelled.
Cancelling an invoice requires the invoice number that was assigned when the invoice was created.

Endpoints

Send your API request message to one of these endpoints:  
Production:
 
POST
https://api.cybersource.com
/invoicing/v2/invoices/
{id}
/cancelation
Test:
 
POST
https://apitest.cybersource.com
/invoicing/v2/invoices/
{id}
/cancelation
Production in India:
 
POST https://api.in.cybersource.com/invoicing/v2/invoices/
{id}
/cancelation
The
{id}
is the invoice number from the response to the create invoice request.

Successful Response

A successful request is indicated by the
canceled
status in the
status
response field and an updated time in the
submitTimeUtc
response field.

Example: Cancelling an Invoice

REST Interactive Example: Cancel an Invoice

Click this image to access the interactive code example for cancelling an invoice.

Figure:

Interactive Code
Image and link to the interactive code example for creating a new
                            invoice.
Light Dark
Endpoint with an Invoice Number
1
https://apitest.cybersource.com/invoicing/v2/invoices/2675/cancelation
Request
1
{}
Response to a Successful Request
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
{"_links": { "self": { "href": "/v2/invoices/2675", "method": "GET" } }, "id": "2675", "submitTimeUtc": "2024-07-24T19:56:06.410896558Z", "status": "CANCELED", "customerInformation": { "name": "Tanya Lee", "email": "tanya.lee@my-email.world", "merchantCustomerId": "1234", "company": { "name": "ABC" } }, "processingInformation": { "requestPhone": false, "requestShipping": false }, "invoiceInformation": { "invoiceNumber": "2675", "description": "This is a test invoice", "dueDate": "2019-07-11", "allowPartialPayments": true, "deliveryMode": "None" }, "orderInformation": { "amountDetails": { "totalAmount": 2623.64, "currency": "USD", "balanceAmount": 2623.64, "discountAmount": 126.08, "discountPercent": 5, "subAmount": 2749.72, "minimumPartialAmount": 20, "taxDetails": { "type": "State Tax", "amount": 208, "rate": 8.25 }, "freight": { "amount": 20, "taxable": true } }, "lineItems": [ { "productSku": "P653727383", "productName": "First line item's name", "unitPrice": 12.05, "quantity": 20, "discountAmount": 13.04, "taxAmount": 0, "taxRate": 0, "totalAmount": 247.86 } ] }}