question

anayooleru avatar image
anayooleru asked parquet76 edited

Order payload doesn't have category and line items in Order doesn't have category. How do I get category?

Orders


  {
            "href": '*********',
            "id": '*********',
            "currency": "USD",
            "employee": {
                "id": '*********'
            },
            "total": 1320,
            "paymentState": "OPEN",
            "title": '*********',
            "taxRemoved": false,
            "isVat": false,
            "state": "OPEN",
            "manualTransaction": false,
            "groupLineItems": false,
            "testMode": false,
            "createdTime": 1689957967000,
            "clientCreatedTime": 1689957967000,
            "modifiedTime": 1689958270000,
            "lineItems": {
                "elements": [
                    {
                        "id": '*********',
                        "orderRef": {
                            "id": '*********'
                        },
                        "item": {
                            "id": '*********'
                        },
                        "colorCode": "#FF0080",
                        "name": '*********',
                        "price": 1200,
                        "printed": false,
                        "createdTime": 1689957967000,
                        "orderClientCreatedTime": 1689957967000,
                        "exchanged": false,
                        "refunded": false,
                        "isRevenue": true
                    }
                ]
            }
        }
Orders
10 |2000

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

parquet76 avatar image
parquet76 answered parquet76 edited
10 |2000

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

anayooleru avatar image
anayooleru answered parquet76 edited

Thanks @parquet76.

How can I expand to get the vendor(the store the items were bought from) details,(name, image/logo, category, address)?

And to get the quantity of each list item?

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

parquet76 avatar image parquet76 commented ·

You don't want to retrieve merchant data each time you make an orders request, that would be wasteful. You should use the merchant endpoints to get that data once (or maybe once a day) as it is relatively static.


For quantity of an item you need to look at the line items. If an order has N quantity of an item there will be N line items (if order has three hot dogs there will be three hot dog line items), the unitQuantity field only applies if an item is priced by unit (grams, ounces, etc.).

0 Likes 0 ·
anayooleru avatar image anayooleru parquet76 commented ·

Each time there is an order, in my webhook, I want to return the specific Order details(which I have been able to), and the merchant(or store) details where the order was made from (I need to know how to do this, expand merchant isn't working)

https://sandbox.dev.clover.com/v3/merchants/*****

Returns the Merchant I created for my account.

I hope you understand what I am trying to explain?
0 Likes 0 ·
parquet76 avatar image parquet76 anayooleru commented ·

As I said, you need to use the merchant end point to get merchant information. So, you will need to make two calls. It is completely unnecessary to get the merchant information every time there is a new order. I would recommend caching/storing that data to reduce the API calls you have to make.

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