question

bb123 avatar image
bb123 asked David Marginian Deactivated converted comment to answer

Discounts not always returned for Orders REST API

Hello, I am attempting to download all Order information at once for a specified time range (expand="lineItems", "payments", "discounts"), and the "lineItems" & Payments always seem 100% correct for each order, but sometimes the "discounts" node is missing from the data for Orders with discounts. When I do the individual querie to find "all discounts for the Order", these discounts show up fine individually, but I would just like to try and download all of this Order information at once to avoid multiple REST calls. Can anyone suggest anything I should be looking for here? When I compare two orders side by side both with discounts, I cannot determine why only one of them shows up in the REST data.

Here is what my REST call looks like:
http://rest.api/orders/?access_token=abcd&filter=createdTime>=10000000&expand=lineItems%2Cpayments%2Cdiscounts

OrdersREST APIDiscounts
10 |2000

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

bb123 avatar image
bb123 answered

Hi David, thanks for the reply. After some digging, it looks like i've figured out why. It appears as though some orders have discounts at the order level (i.e. 10% off entire order), where as some other orders have the discounts on the line items themselves. So when I do the "expand" to see the discounts at the order level, it only shows up for those with the discounts on the order header, vs the line items.

When I do the individual query to show all discounts for a single order, the line items discounts then appear. So it looks like I will need to do discounts query individually per order to always receive the correct discount details.

Thanks again for your help

10 |2000

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

David Marginian avatar image
David Marginian Deactivated answered

You can't download all of the order information at once, perhaps that is your problem - https://docs.clover.com/clover-platform/docs/paginating-elements.

10 |2000

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

bb123 avatar image
bb123 answered David Marginian Deactivated converted comment to answer

Thanks for the reply, but my sample data set that I'm working with is pretty small (just 10 orders). But perhaps the API is not powerful enough to consistently return the fully expanded order details: lineItems, Discounts, and Payments all at once. For my 10 sample orders, 7 have discounts, but only 4 of these show the actual "discounts" node in the JSON data. When I do individual queries for the discounts on the missing 3, they show up fine with the /orders/discounts/ call … but I was just hoping to do this all at once in one call as per the documentation.

1 comment
10 |2000

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

David Marginian avatar image David Marginian ♦♦ commented ·

Is it consistently the same orders that always lack the discounts when you do the full query? What environment are you doing this query and what is your merchant id (please include this in a private post)? Also, give me a few dates when you have run the query.

0 Likes 0 ·

Welcome to the
Clover Developer Community