Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

Invalid or undocumented invoice type

Started by Julian Castles -   in API Endpoints

Hi there,

According to the API documentation for invoices, an invoice type can be one of two values, ACCPAY or ACCREC (https://developer.xero.com/documentation/api/types#InvoiceTypes). Using the Xero website, I did the following:
Created a new bill for $250.
Created a payment of the bill for $500 - part of this step was to create an overpayment of $250.
On the overpayment, I created a refund for $250.

If I use the Xero previewer to list all the payments, I get a payment with an invoice type of APOVERPAYMENT. Is this an invalid invoice type, or is the documentation incorrect? Are there any other invoice types that are not documented?

Regards
Julian
Hi,

Your seeing payment they get linked to invoices that why they show up in your calls.

https://developer.xero.com/documentation/api/types#PaymentTypes

https://developer.xero.com/documentation/api/payments

Henzard Kruger
Certified Advisor and Full Stack developer
Picahoo cc - 0711304241 - henzard@picahoo.co.za
Skype: henzard, Gtalk: henzardkruger@gmail.com
Quality is remembered long after the price is forgotten
 

Henzard Kruger  

Hi there,

Thank you for the quick reply. If I follow the API document, it says that a payment contains an invoice and an invoice type can be one of 2 values - there is no mention of an invoice displaying payment types. Does this mean that it is a documentation bug?

In the JSON that is returned when making the call, I can see the following:
"Payments":
"PaymentType": "APOVERPAYMENTPAYMENT",
"Invoice":
"Type": "APOVERPAYMENT"

I also made the call using the Xero C# SDK. In that case, the call still returned APOVERPAYMENT, but they mapped it to an invoice type of AccountsPayable.

Regards
Julian
 

Julian Castles  

Hi,

Yes Xero uses open item matching. So each payment is linked to 1 or several invoices. Thus when you make a over payment they need to link it to a invoice until it's linked at a later stage. That's what your seeing there.
 

Henzard Kruger  

Hi there,

Thank you for the reply. I must admit that I am still a bit confused about this not being addressed in any of their documentation. I had a closer look at their C# SDK. They also don't cater for this scenario - when the invalid invoice type value comes in, they try to parse it. None of their parsing mechanisms succeed after which they just return the default value of the invoice type enum (AccountsPayable).

For now, we've decided to go with a workaround in our implementation.

Regards
Julian

 

Julian Castles