Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Wrapper libraries >

Remove credit note allocation via API (add line item to invoice with payments or allocations)

Started by Adam Cowen -   in Wrapper libraries


I'd like to check on the status of removing a credit allocation via the C# wrapper. I've seen some old UserVoice requests and am wondering the status. I'm using Xero.API.SDK.Minimal version

My overall requirement is to add a new line-item to an existing, approved invoice for a late payment. The invoice may have partial payments, and may have credit notes applied to it.

The api doesn't allow this without first removing all payments and credit note allocations. I can remove the payments from the invoice, but it doesn't appear that I can remove Credit Note allocations except in the Xero UI.

* The Invoice and Credit Note are ACCREC

1. Is there a way in the API to remove the credit note allocation?
2. Is there a way to void the credit notes in the api. The documentation states I should be able to void a credit note, but I have been unable to change the status.

I'd like to avoid, if possible, emailing the finance team and asking if they can manually adjust the invoice.

API REF: https://developer.xero.com/documentation/api/credit-notes

> Overview
> Allows you to void approved credit notes
> POST CreditNotes
> Use this method to create or update a credit note.
> PUT CreditNotes
> The PUT method can be used to create CreditNotes or allocate CreditNotes to outstanding Invoices.

I've tried a number of ways to void or delete the credit note, but the API fails every time. I can provide more information if required.

Best Reply as chosen by Adam Cowen (Original Poster)
Hi Adam,

As stated in the credit notes endpoint documentation, the endpoint allows you to void approved credit notes. This means you can change the <Status> from
'AUTHORISED' to 'VOIDED' and not from <PAID> to 'VOIDED'. Once you allocate the Credit note to an invoice the status of the credit note changes from 'AUTHORISED' to 'PAID' and hence you cannot void them from the API any more.

To answer your question Xero API doesn't allow you to void creditnotes that are allocated ( ie.. credit notes with Status 'PIAD' can't voided via the Xero API). UI allows you to remove the allocation link between a credit note and an invoice which changes back credit status to authorized, after which you can void it from API if you want to.

Hope this helps.


Srikrishna Tadinada (Community Manager)