question

billmoller avatar image
billmoller asked billmoller commented

I'm trying to get my first ever transaction, but results show me data from 3 days ago...

I'm using the following URL:

"payments?expand=cardTransaction,taxRates,lineItemPayments,refunds,order,tender,employee&orderBy=createdTime%20ASC&offset=0&limit=1"

It returns transaction with ID: BFPVD5YC6PQRT on 09-Feb-2016 2:09 pm

But my first ever transaction is: BER8957JDE1ZC on 26-Jan-2016 2:54 pm

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Mike M avatar image
Mike M answered billmoller commented

orderBy=createdTime%20ASC is why you're getting your older transactions first. Try changing ASC to DESC

3 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

billmoller avatar image billmoller commented ·

DESC returns: EPNY8NVKR4936 on 12-Feb-2016 1:51 pm, my most recent transaction... also, created descending should be the latest, so I expected ascending to be the earliest.

0 Likes 0 ·
billmoller avatar image billmoller commented ·

I just called it again with ASC, and it returned: ID: 0GDJR2WNF4PWC 09-Feb-2016 2:56 pm, as if the "payments" method only goes back to a three day window?

0 Likes 0 ·
Mike M avatar image Mike M commented ·

Sorry, I misunderstood your question. I dove into our server code and am adding on to Jim's answer.

0 Likes 0 ·
billmoller avatar image
billmoller answered

DESC returns: EPNY8NVKR4936 on 12-Feb-2016 1:51 pm, my most recent transaction...

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jim-patel avatar image
jim-patel answered billmoller commented

https://docs.clover.com/build/web-apps/web-api/#pagination might explain your problem. You get up to 100 results by default.

3 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Mike M avatar image Mike M commented ·

There is apparently some custom logic on the Payments endpoint, likely created in response to developer abuse or something. Basically, it breaks it down the payments into time segments whenever a query is missing a modifiedTime filter. To avoid this, add a modifiedTime filter to your request to query less than the current timestamp (or provide a better timestamp range).

I actually was able to test this on your test merchant too, and I have verified the response is what you are looking for. /payments?orderBy=createdTime%20ASC&filter=modifiedTime<1455318559000

0 Likes 0 ·
Mike M avatar image Mike M commented ·

Without the modifiedTime query and with a limit+offset less than 500, the server automatically adds a 3 days filter as you described. As the limit+offset increases, the days filter changes as well.

0 Likes 0 ·
billmoller avatar image billmoller commented ·

Thank you Mike! I knew I was missing something. It sounds like you figured it out. I'll try this when I return.

0 Likes 0 ·

Welcome to the
Clover Developer Community