Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

Update a paid invoice

Started by Ryan Brady -   in API Endpoints

Hello everyone:

I am in the earliest stages of creating a small in-house app to basically perform functions like the native Find & Recode feature of Xero except that my desire is to have the ability to find and recode individual line items throughout a query of invoices or bills. For example, an invoice comes with a line item for a product and a line item for the coupon used in the sale; I would like to recode the coupon to a different account.

My current hurdle is that it appears an invoice with a payment applied to it cannot be edited through the API like it can through the stock GUI. I get this error in the previewer:

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

This is an issue for my application because all my invoices come into Xero paid. (It is a flow from Shopify to TradeGecko to Xero, and TradeGecko marks them paid; this does help my general accounting practices in some other ways but not in this case.)

Do you have any suggestions on how to get around this, if it is possible? As I mentioned, my vision is much like the Find & Recode feature, but Find & Recode cannot operate on individual line items within a document.

Thank you very much,

You cannot unpay, remove payment or update a invoice using the API. It's just not possible.

Kind Regards

Remember I consult on a per hour basis. Contact me if your need me to fix the problem. $45 per hour.

Henzard Kruger
Certified Advisor and Full Stack developer
Picahoo cc - 0711304241 - henzard@picahoo.co.za
Skype: henzard, Gtalk: henzardkruger@gmail.com


Henzard Kruger  

Hi, Henzard:

Darn. Thank for you for the reply!

— Ryan

Ryan Brady  

Payment can be deleted using API now - https://developer.xero.com/documentation/api/payments#POST

So to edit paid invoices via API, the payments need to be removed first, edit the invoice and the re-apply the payment

michael green1  

Hi, Michael:

Ah, thank you very much! I will have to wait until I get further to the development because I have only been using the API Previewer, there there is no POST options for the Payments endpoint yet.

Thank you,

Ryan Brady  

You could use Postman whilst in the early stages, we have a tutorial that steps you through the process.

This would allow you to make calls to endpoints not supported in the API Previewer.


Robin Blackstone (Community Manager)  

Ah, great; thank you!

Ryan Brady