On This Page
REST API
Cancel an Invoice
You can cancel an invoice if no payment is made to it. To cancel an invoice, pass the invoice
ID as a path parameter in the invoices resource. You cannot cancel partially or fully paid
invoices.
Use this resource to cancel an invoice:
- Test:POSThttps://apitest.cybersource.com/invoicing/v2/invoices/{id}/cancelation
- Live:POSThttps://api.cybersource.com/invoicing/v2/invoices/{id}/cancelation
- Live in India:POST https://api.in.cybersource.com/invoicing/v2/invoices/{id}/cancelation
For more details, see the Cancel an Invoice section of the interactive API
Reference.
All
Cybersource
APIs require API authentication. See
Getting Started with the REST API
for details. Request
To cancel an invoice, pass the invoice ID as a path parameter.
Request example:
POSThttps://apitest.cybersource.com/invoicing/v2/invoices/A123456/cancelation
Response
A successful response changes the
invoice
status
to canceled
and updates
the submitTimeUtc
. The response includes the invoice details
and _links
. You cannot send, re-cancel or update a canceled invoice. To get the invoice details again, use the
self
link path:https://apitest.cybersource.com
/v2/invoices/A123456Response example:
{ "_links": { "self": { "href": "/invoicing/v2/invoices/A123456", "method": "GET" } }, "id": "A123456", "submitTimeUtc": "2020-02-10T06:32:06Z", "status":"CANCELED", "customerInformation": { "name": "Tanya Lee", "email": "[email protected]" }, "invoiceInformation": { "invoiceNumber": "A123456", "description": "This is a test invoice", "dueDate": "2019-07-11" }, "orderInformation": { "amountDetails": { "totalAmount": "2623.64", "currency": "USD", "balanceAmount": "2623.64", "discountAmount": "126.08", "discountPercent": "5", "subAmount": "2749.72", "taxDetails": { "type": "State Tax", "amount": "208.04", "rate": "8.25" }, "freight": { "amount": "50.00", "taxable": "true" } }, "lineItems": [{ "productSku": "P653727383", "productName": "First line item's name", "quantity": "21", "unitPrice": "120.08" }] } }