On This Page
REST API
Update an Invoice
To update an unpaid invoice, pass the invoice ID as a path parameter, and in the request
body, pass the invoice details.
You can update an invoice only if no payment has been made on the invoice.
Use the following resource to update an invoice:
- Test:PUThttps://apitest.cybersource.com/invoicing/v2/invoices/{id}
- Live:PUThttps://api.cybersource.com/invoicing/v2/invoices/{id}
- Live in India:PUT https://api.in.cybersource.com/invoicing/v2/invoices/{id}
For more details, see the Update 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 update an invoice, include the following
UpdateInvoice
fields in the request body: - customerInformation
- invoiceInformation
- orderInformation
An invoice can include up to 30 line items, in the
lineItems
object.When you update an invoice:
- If you update the customer's email address of a sent invoice, the value of theinvoiceInformation.paymentLinkfield changes. The old link to the invoice no longer works. Either the merchant can provide the updated invoice link to the customer, or use the API to resend the invoice to the customer.
- You cannot update the invoice number.
Request example:
{ "customerInformation": { "name": "Tanya Lee", "email": "[email protected]" }, "invoiceInformation": { "description": "This is a test invoice", "dueDate": "2019-07-11", "allowPartialPayments": "true", "deliveryMode": "email" }, "orderInformation": { "amountDetails": { "totalAmount": "2653.64", "currency": "USD", "discountAmount": "126.08", "discountPercent": "5", "subAmount": "2779.72", "minimumPartialAmount": "20", "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" }] } }
Response
If the request is successful, the API returns the details of the updated invoice. The response also includes
_links
and _supportedActions
. - Link:To get the invoice details again, use theselflink path:GEThttps://apitest.cybersource.com/v2/invoices/A123456
- Supported actions:
- Send: Use thedeliveryaction to send a draft or created invoice or to resend a sent or partially paid invoice. Paid or canceled invoices cannot be resent at this time. See Send an Invoice for details.
- Cancellation: Use thecancelationaction to cancel an invoice. See Cancel an Invoice for details.
- Update: Use thePUTHTTP method to update the invoice again, as long as no payment has been made on the invoice.
Response example:
{ "_links": { "self": { "href": "/invoicing/v2/invoices/A123456", "method": "GET" } }, "_supportedActions": [{ "href": "/invoicing/v2/invoices/A123456/delivery", "method": "POST" }, { "href": "/invoicing/v2/invoices/A123456/cancelation", "method": "POST" }, { "href": "/invoicing/v2/invoices/A123456/", "method": "PUT" }], "id": "A123456", "submitTimeUtc": "2020-02-10T06:32:06Z", "status": "SENT", "customerInformation": { "name": "Tanya Lee", "email": "[email protected]" }, "invoiceInformation": { "invoiceNumber": "A123456", "description": "This is a test invoice", "dueDate": "2019-07-11", "paymentLink": "https://businesscenter.cybersource.com/invoicing/payInvoice/ c7UI9Vz8rdhXbc8FdK6SaoeOATON4TQLhbd5lfib9UCyywvZLhIrSuYYNFMynMDd" }, "orderInformation": { "amountDetails": { "totalAmount": "2653.64", "currency": "USD", "balanceAmount": "2653.64", "discountAmount": "126.08", "discountPercent": "5", "subAmount": "2779.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" }] } }