1

There doesn't seem be an option to set the page quantity in the Payment endpoint for the GET method. I need to pull the data from every line item within a payment, but cannot see a workaround. Has anyone else come up with a solution?

1 Answers1

0

Hi @Casey and welcome to SO!

According to Xero (source):

You can use pagination to retrieve line item details for 100 items (e.g. Invoices) at a time. Endpoints on the Accounting API that currently support pagination are invoices, contacts, bank transactions and manual journals. All major endpoints on the Payroll, Files and Assets APIs also support paging. Use the If-Modified-Since header to retrieve only what's changed since your previous request

However, regarding Payments, Xero's API documentation mentions how to filter or sort results but not how to paginate them, very surprising. Back in 2012 they officially confirmed this was not supported and considered it as a Feature Request.

Here's a potential solution:

I would use the 4th example in the Retrieving a filtered set of resources using the “where” parameter section here: https://developer.xero.com/documentation/api/requests-and-responses and build a pagination myself using date ranges.

Date >= DateTime(2019, 01, 01) && Date < DateTime(2019, 01, 02)
Date >= DateTime(2019, 01, 02) && Date < DateTime(2019, 01, 03)
etc.

You might also consider achieving this using the Reference variable (assuming it has numerical values) which is available in the Payments GET request too.

I hope this helps!

Bruno Leveque
  • 2,647
  • 2
  • 23
  • 33
  • I appreciate the answer. I'll try that and see if it's a good solution, but do you think this will give me the multiple line items within the payment record? There is a lot more information in the payment that I will need which the "top-level" stuff (reference, invoice number, amount, contact into, etc) doesn't provide. Some of our bills have multiple line items that isn't given to me through the payment endpoint. – Casey Cooley May 23 '19 at 18:59
  • I'm not sure about that (I've never used Xero's API before) so that's just a guess. – Bruno Leveque May 23 '19 at 19:08