XM

Apply Promo

Path:

PATCH /cart/apply-promo

Shoppers find good deals hard to resist; discovering and availing deals (offers, coupons, or discounts) give them an enhanced shopping experience. This API enables users to add promotional code to their cart, at any stage before the billing.

Headers

Content-Type :application/json

x-site-context :{"date":"2020-06-04T13:16:09.000Z","channel":12}

Consumes

  • application/json

Produces

  • application/json

Parameters

Type: body

Name: cartId and promName

Required: true

Sample Request

{
"cartId": "5ebb70ea1139d50008036d53",
"promoName": "TEST20"
}

Response

Response Code: 200

Message: OK

{
"_id": "5ebb70ea1139d50008036d53",
"deleted": false,
"isLoggedIn": false,
"cartId": 136,
"items": [
{
"price": {
"discount": {
"price": 260,
"promosApplied": [
{
"unit": "%OFF",
"value": 10,
"ON": {
"kind": "SKU",
"value": null
},
"promoId": "5eba961dd5c898000811586f",
"promoCode": "TEST20"
}
]
},
"sale": 300,
"base": 400,
"currency": "USD"
},
"discountedQuantity": 2,
"group": [
"5ddd1a156c5a5fed1e0d91fb"
],
"createdAt": "2020-05-13T03:57:13.569Z",
"updatedAt": "2020-05-13T04:06:49.589Z",
"_id": "5ebb70ea1139d50008036d54",
"itemId": 1000000016,
"quantity": 2,
"sku": "1586729",
"taxCode": "PH060771",
"lineItemId": 1,
"totalPrice": {
"currency": "USD",
"amount": 520
},
"id": "5ebb70ea1139d50008036d54"
}
],
"allPromosApplied": [
{
"promoId": "5eba961dd5c898000811586f",
"promoCode": "TEST20"
}
],
"createdAt": "2020-05-13T04:00:42.935Z",
"updatedAt": "2020-05-13T04:06:49.597Z",
"__v": 0,
"totalAmount": {
"currency": "USD",
"amount": 520
},
"quantity": 2,
"errors": {
"inventory": [],
"price": [],
"promo": [
{
"promoChange": true
}
]
}
}

Response Code: 404

Message: Promo not found

Response Code: 400

Message: Promo already applied

Changelog

  • April-2021 last updated

  • July-2020 First updated