Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

Can I change the status of an Invoice thru API??

Started by Has Taiar -   in API Endpoints

I am trying to change the status of an Inovice to "PAID" / "VOIDED" with no luck.. it keeps giving me the validation error

"Invoice not of valid status for modification"

I just do not get it, why?? I have tried making my invoices "approved" / "submitted" or "authorised" before trying to do the changes but it seems not to have an change...

I should be able to change the status of my invoice at any time, should not I ??

would appreciate any response

Thanks
Has
Hi Has,

Yes, you can change invoices statuses via API.

The following status transitions can be done via API:

- DRAFT to DELETED
- DRAFT to SUBMITTED
- DRAFT to AUTHORISED
- SUBMITTED to DRAFT
- SUBMITTED to DELETED
- SUBMITTED to AUTHORISED
- AUTHORISED to VOIDED

Here is an example of a call to void an invoice:

<Invoice>
<InvoiceID>8afaa43d-793c-4154-915f-e574c762ff67</InvoiceID>
<Status>VOIDED</Status>
</Invoice>

However, to change an invoice to PAID, you have to apply a full payment to it either via API with <Payments> endpoint or web UI.
 

W. Abdullah (Community Manager)  

Thanks Welli, Appreciate your response,

but how about voiding an invoice after it is paid??

Let 's say I put an order through, complete payment, then I needed to refund the invoice??

I need to change status from PAID >> VOIDED !!!

Thanks once again for the response

Cheers
 

Has Taiar  

Invoices that have payments applied against them cannot be modified. If you tried to modify them, you will get the following error message:

<Message>This document cannot be edited as it has a payment or credit note allocated to it.</Message>

The payments have to be removed via the web UI first before you can modify them.
 

W. Abdullah (Community Manager)  

Are you planning on making it so payments can be edited via the API?
 

Christopher Laudadio  

It is possible to delete payment via API?
 

mukesh chaudhari