Update Basket - Discount(s) Run in API Explorer
Ask AI
PATCH
/commerce/{accountId}/baskets/{basketId}/discounts
curl \
--request PATCH 'https://api.staging.deliverect.com/commerce/{accountId}/baskets/{basketId}/discounts' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '[{"type":"order_flat_off","provider":"coupon","amount":100,"name":"CONGRATS! HERE IS 1 EUR OFF"}]'
Request examples
Order flat off
[
{
"type": "order_flat_off",
"provider": "coupon",
"amount": 100,
"name": "CONGRATS! HERE IS 1 EUR OFF"
}
]
[
{
"type": "order_percent_off",
"provider": "restaurant",
"value": 1000,
"name": "CONGRATS!10% OFF"
}
]
[
{
"provider": "restaurant",
"name": "Free coke",
"type": "item_free",
"plu": "DLX-3",
"menuId": "668f7ff64dc853**c96**877",
"externalId": "discount-123"
}
]
[
{
"provider": "restaurant",
"name": "",
"type": "item_bogof",
"plu": "DLX-3",
"menuId": "668f7ff64dc853**c96**877",
"externalId": "discount-bogo"
}
]
[
{
"type": "item_flat_off",
"provider": "restaurant",
"externalId": "discount-item-flat-123",
"name": "Item flat off: $5",
"menuId": "668f7ff64dc853**c96**877",
"value": 5000,
"itemIds": [
"6900f2f01306779be71e7b8e"
]
}
]
[
{
"type": "item_percent_off",
"provider": "restaurant",
"externalId": "discount-123",
"name": "Item percent off: 25%",
"menuId": "668f7ff64dc853**c96**877",
"value": 2500,
"itemIds": [
"6900f2f01306779be71e7b8e"
]
}
]
[
{
"type": "wallet_cash",
"value": 1000,
"provider": "loyalty",
"externalId": null
}
]
[
{
"type": "compensation_card",
"provider": "restaurant",
"externalId": "cardnumber-123",
"value": 5000,
"name": "Compensation card for $5"
}
]
Response examples (200)
{
"id": "6643782d0c1914c93a846834",
"created": "2024-05-14T14:41:49.738000+00:00",
"updated": "2024-05-14T15:19:37.173000+00:00",
"deleted": false,
"etag": "c2046a6b9c21b9ebb38f8094c0a3ca02240742b3",
"accountId": "65c35d109a19b819b7cf78d8",
"storeId": "65eee6a9984a1bc1b9637c59",
"channelLinkId": "65eee6a9984a1bc1b9637c59",
"channelOrderId": null,
"channelOrderDisplayId": null,
"currency": "EUR",
"taxExclusive": false,
"status": "open",
"items": [
{
"menuId": "62d7f77f64c95193cc29aa91",
"plu": "STK-01",
"name": "Delicious Steak Frites",
"quantity": 1,
"price": 1500,
"gross": 1500,
"taxes": [],
"net": 1450,
"subItems": [],
"discounts": [
{
"referenceId": 1,
"amount": 50
}
],
"discountTotal": 50
}
],
"payment": {
"tips": [],
"discountsTotal": 50,
"taxTotal": 0,
"tipTotal": 0,
"total": 1450
},
"customer": {
"name": "Test",
"companyName": "Company LTDA",
"phoneNumber": "12345",
"email": "test@email.com"
},
"fulfillment": {
"type": "pickup"
},
"taxes": [],
"discounts": [
{
"type": "order_flat_off",
"referenceId": 1,
"amount": 50,
"provider": "restaurant",
"name": "CONGRATS! HERE'S 5 EUR OFF"
}
]
}
Response examples (400)
{}