question

fms avatar image
fms asked David Marginian Deactivated edited

Having issue fetching the Quantity from orders history for a Fixed Price Item using REST API

Hello,

We are using the Orders API "https://sandbox.dev.clover.com/v3/merchants/mId/orders/orderId/line_items "


We call this API to fetch the history of the order to figure out the sales history and we get a response but we don't get the Quantity field (""unitQty":0") in the response.


Can you please advise on why we are not getting this?

Or is there any other way to fetch this?


Please advise.


Thank you,

FMS


OrdersREST API
10 |2000

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

1 Answer

·
David Marginian avatar image
David Marginian Deactivated answered David Marginian Deactivated edited

Have you tried ?expand=item?

14 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.

fms avatar image fms commented ·

Hello David,

Yes, we tried ?expand=item? but this is getting us the stock quantity and not quantity sold in that Order.

Expand item provides a stock count for the line item. We need to fetch the quantity of that line item ordered.

Basically, we are building a module that displays a merchant about their sales history so for that, we would like to fetch the history of the order and get the Quantity sold.



0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ fms commented ·

Do you understand what unitQty is? Per the REST API docs (https://docs.clover.com/reference#ordercreatelineitem-2):

Unit quantity if this line item is priced by quantity, or null if the item is not priced by quantity. The value is a fixed-point integer with scaling factor of 1000 (e.g. if charging by ounces then the value should be set to 2500 for 2.5 ounces). To compute the complete price perform the following calculation: PRICE * (UNIT QTY / 1000).

Otherwise, I believe each line item represents a single item:

https://docs.clover.com/docs/working-with-orders#adding-order-line-items

Each line item represents a single inventory item, a single portion of a variable-price item, or an individual custom item/manual transaction amount.


0 Likes 0 ·
fms avatar image fms David Marginian ♦♦ commented ·

Thank you for the information but we actually need to fetch the Quantity for the Fixed price item. How can we fetch it using which field from Orders history?

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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

Welcome to the
Clover Developer Community