question

habib avatar image
habib asked David Marginian Deactivated answered

Create Atomic order with discount

Request but not working discount

,

{"orderCart":{

"lineItems":[{"item":{"id":"9P37T4PJ7YMEE","Qty":"3"},"modifications":[{"modifier":{"id":"Y6V9D1M23AKHY"},"name":"Extra_clover","amount":1200},{"modifier":{"id":"YX8HHJVXP51B4"},"name":"Extr11","amount":12300}]},{"item":{"id":"13NDSR35N7664"},"modifications":[{"modifier":{"id":"YX8HHJVXP51B4"},"name":"Extr11","amount":12300}]},{"item":{"id":"ZKZ1EH41TPZBT"},"modifications":[{"modifier":{"id":"YX8HHJVXP51B4"},"name":"Extr11","amount":12300}]

}]

}, "discounts":[{"name":"discount","amount":"1200"}]}

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.

David Marginian avatar image
David Marginian Deactivated answered

"discounts" needs to be nested within the orderCart. Per your request you have "discounts" at the same level as the order cart.

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 converted comment to answer

Providing the error/response you are receiving would be helpful.

I am guessing the problem is the "amount" property on the discount. It should be a negative number, not a string.

{
....
"amount": -1200
}


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

habib avatar image habib commented ·

getting message

order successfully created. Order Id is- FXWAW9QTKNZF4 

but discount not working

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

You will need to provide an explanation of what not working means. Also, since you created the order and then deleted it, I cannot look at it.

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

I have created atomic order and using discount on that order on single call order is created successfully but discount is not working this is my request

{"orderCart":{

"lineItems":[{"item":{"id":"9P37T4PJ7YMEE"},"modifications":[{"modifier":{"id":"Y6V9D1M23AKHY"},"name":"Extra_clover","amount":1200},{"modifier":{"id":"YX8HHJVXP51B4"},"name":"Extr11","amount":12300}]},{"item":{"id":"13NDSR35N7664"},"modifications":[{"modifier":{"id":"YX8HHJVXP51B4"},"name":"Extr11","amount":12300}]},{"item":{"id":"ZKZ1EH41TPZBT"},"modifications":[{"modifier":{"id":"YX8HHJVXP51B4"},"name":"Extr11","amount":12300}]

}]

},

"discounts":[{"name":"discount","amount":-1200}]}

0 Likes 0 ·
Show more comments

Welcome to the
Clover Developer Community