question

aadel avatar image
aadel asked ·

Getting List of Orders Using the SDK

Hi,

What's the best way to get a list of merchant orders using the SDK, similar to GET /v3/merchants/{mId}/orders REST end-point?

Best,
A.
OrdersSandboxEmulator
2 comments
10 |2000 characters needed characters left characters exceeded

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

Can you clarify where your code is running, on clover device, on your server, somewhere else?

0 Likes 0 · ·
aadel avatar image aadel Jacob Abrams ♦♦ ·

@Jacob Abrams it's running on Android emulator Clover Mini Gen 2 and SDK level 25.

0 Likes 0 · ·

1 Answer

Jeffrey Blattman avatar image
Jeffrey Blattman answered ·
You can use OrderContract.Summaries, then fetch individual orders by UUID using OrderConnector.getOrder(...) or getOrders(...). Note that this is only for the on-device orders. It does not go online, and can only access the subset of orders that are cached on the device (up to 100 days of orders).
6 comments Share
10 |2000 characters needed characters left characters exceeded

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

Thanks @Jeffrey Blattman for your reply. What's the definition of on-device orders and what is the difference/intersection set between on-device orders and on-line at any given time? Is the API end-point behavior similar?

0 Likes 0 · ·

This is all subject to change.
In general, there should be a summary for each order on the device. A device should have the last ~100 days worth of orders on it, though it may take some time to sync all of the orders from the server, as orders older than 7 days sync at a slower rate and only during off-peak hours. This typically is only an issue for a day or a few days after a new device is setup/factory reset/db is dropped due to corruption.
When orders are older than 100 days, the local order is deleted, but the summary stays in the database.
When an order is searched for in the Orders app, it summary is added to the summaries table.

High order volume merchants may have hundreds of thousands of orders in their orders db, so some care is necessary with selections if you are searching on fields.

I am not familiar with the exact behavior of the REST api orders endpoint.


We may eventually release some improvements to provide a more well defined summary table that has ~100 days worth of summaries + indexes to support fastering searches + server queried orders + a mechanism to query our server + an indicator if it is done syncing older orders, but that is not actively being developed.

1 Like 1 · ·

Thanks @Dan for your reply. It's not clear though how "it may take some time to sync all of the orders from the server" in case of new device setup. Are there are any data/orders that are shared between devices?

0 Likes 0 · ·
Show more comments

Welcome to the
Clover Developer Community