question

bassem avatar image
bassem asked David Marginian Deactivated commented

REST Api : add modifiers to line items

I successfully create an order with multiple products in clover via API REST.

using the two ws :

1- Create order

https://apisandbox.dev.clover.com/v3/merchants/DA7BPW2G45DK1/orders


2- Add a line item to an order

https://apisandbox.dev.clover.com/v3/merchants/KAN6C75Q4DT11/orders/5TZZ5Q68PE6HA/line_items


but also i want to add a modifiers to line items.

Could you help how i can add a modifiers to line items via API REST


Thank you.


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

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

Please take a look at our docs - https://docs.clover.com/docs/working-with-orders#adding-item-modifiers.

That being said, we have a new API that is not fully documented yet that will allow you to create all of the necessary parts of an order in a single call - https://docs.clover.com/reference#ordercreateatomicorder. This endpoint currently only works for Clover inventory and the taxRates assigned to the item will be applied without the ability to override.

Here is an example request for ordercreateatomicorder:

{
    "orderCart": {
        "lineItems": [
            {
                "item": {
                    "id": "{CloverInventoryUuidHere}"
                },
                "modifications": [
                    {
                        "modifier": {
                            "id": "{modifierUuidHere}"
                        },
                        "amount": 500,
                        "name": "{modifierNameHere}"
                    }
                ]
            }
        ]
    }
}


10 |2000

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

bassem avatar image
bassem answered David Marginian Deactivated commented

I create a new modifier by calling the ws

1- Create modifier

POST/ https://sandbox.dev.clover.com/v3/merchants/DA7BPW2G45DK1/modifier_groups/GAJBXJD95ADXJ/modifiers

capture-decran-2021-03-01-a-54653-pm.png



Then i try to create a new order via calling the ws

2- Create order

https://www.clover.com//v3/merchants/QVZSFHSEEQD61//atomic_order/orders

capture-decran-2021-03-01-a-55051-pm.png

As you can see in the screenshot i add the id of the modifier.

but when i see the order details in Dashboard, I see that the order is created without modifier.

Can you help me please how can i add a modifier to my order ?

Thank you.


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

David Marginian avatar image David Marginian ♦♦ commented ·

modificateur is not a valid property on modifications. You must pass the request exactly as we expect, see the example I provided.

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

thank you
it's work

0 Likes 0 ·
bassem avatar image bassem bassem commented ·

Now, I need to add tax to this order.

how can i do this via API Rest.

capture-decran-2021-03-01-a-84303-pm.png


here is the ws i call it to create the order

POST https://www.clover.com//v3/merchants/QVZSFHSEEQD61//atomic_order/orders

Body-request

{
    "orderCart" : { 
        "lineItems" : [ 
            {
                "item" : { 
                    "id" : "ZN689TBQY2K8R" 
                } ,
                   "modifications" : [ 
                    {
                        "modifier" : { 
                            "id" : "PMSQXS0N72M48" 
                        },
                        "amount": 500,
                        "name": "{modifier name 1}"
                    },
                    {
                           "modifier" :
                        { 
                            "id" : "PMSQXS0N72M48" 
                        },
                        "amount": 500,
                        "name": "modifier name 2"
                    }
                ]                 
           } 
        ]
    }
}


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