XM
Members
Apply Promo
This documentation is now outdated, please find the latest docs for this endpoint here
Path:
1
PATCH https://{baseurl}/api-cart/cart/apply-promo
Copied!
Shoppers find good deals hard to resist; discovering and availing deals give them an enhanced shopping experience. This API enables your customers to easily add promotional code to their cart, at any stage before billing.

Headers

Content-Type : application/json
x-site-context : { "date": "2020-08-28T02:35:27.787Z", "channel": 12, "account": 5f493c9f30ec2a0007a94fc8", "stage": "sandbox" }

Parameters

Type : requestBody
Name : The 24 character system-generated cart ID (from the Add Items to Cart or Retrieve Cart by Authorization Token API) and the promoName.
Required: true

Sample Request

path:
1
PATCH https://{baseurl}/api-cart/cart/apply-promo
Copied!
Request Body
1
{
2
"cartId": "607f8a8f0118960009a8e6ee",
3
"promoName": "custdash"
4
}
Copied!

Sample Response

Success Code: 200
Message: OK
Description: You'll see this message when the promo is successfully applied.
1
{
2
"_id": "607f8a8f0118960009a8e6ee",
3
"deleted": false,
4
"registeredUser": true,
5
"cartId": 1475,
6
"items": [
7
{
8
"price": {
9
"discount": {
10
"discountAmount": 450,
11
"price": 450,
12
"promosApplied": [
13
{
14
"unit": "%OFF",
15
"value": 50,
16
"ON": {
17
"kind": "SKU",
18
"value": null
19
},
20
"id": "6063ed0158d627000720d39d",
21
"promoId": "605b821da953e9000759f735",
22
"promoCode": "custdash"
23
}
24
]
25
},
26
"sale": 0,
27
"base": 900,
28
"currency": "USD"
29
},
30
"sample": false,
31
"discountedQuantity": 4,
32
"group": [
33
"123123123123123213212222"
34
],
35
"weightUnit": "lb",
36
"isPickup": false,
37
"createdAt": "2021-04-21T02:14:38.620Z",
38
"updatedAt": "2021-04-21T18:44:41.712Z",
39
"_id": "607f8a8f0118960009a8e6ef",
40
"itemId": 1000000051,
41
"quantity": 4,
42
"priceListId": 100269,
43
"sku": "1538910",
44
"taxCode": "PH060771",
45
"title": "Luminous Cushion Lagoon",
46
"weight": 1,
47
"lineItemId": 1,
48
"attributeTotalPrice": 0,
49
"totalPrice": {
50
"currency": "USD",
51
"amount": 1800
52
},
53
"attributes": [],
54
"id": "607f8a8f0118960009a8e6ef"
55
},
56
{
57
"price": {
58
"discount": {
59
"discountAmount": 0,
60
"price": 0,
61
"promosApplied": []
62
},
63
"sale": 48,
64
"base": 148,
65
"currency": "USD"
66
},
67
"sample": false,
68
"discountedQuantity": 0,
69
"group": [
70
"123123123123123213212222"
71
],
72
"weightUnit": "lb",
73
"isPickup": false,
74
"createdAt": "2021-04-21T02:14:38.620Z",
75
"updatedAt": "2021-04-21T18:44:41.713Z",
76
"_id": "607f8a8f0118960009a8e6f0",
77
"itemId": 1000000052,
78
"quantity": 2,
79
"priceListId": 100269,
80
"sku": "1583908",
81
"taxCode": "PH060771",
82
"title": "Embellished Pillow Pink",
83
"weight": 1,
84
"lineItemId": 2,
85
"attributeTotalPrice": 0,
86
"totalPrice": {
87
"currency": "USD",
88
"amount": 96
89
},
90
"attributes": [],
91
"id": "607f8a8f0118960009a8e6f0"
92
}
93
],
94
"userId": "600a56593245200007982fac",
95
"allPromosApplied": [
96
{
97
"promoId": "605b821da953e9000759f735",
98
"promoCode": "custdash"
99
}
100
],
101
"attributes": [],
102
"createdAt": "2021-04-21T02:14:39.048Z",
103
"updatedAt": "2021-04-21T18:44:41.759Z",
104
"__v": 0,
105
"totalAmount": {
106
"currency": "USD",
107
"amount": 1896
108
},
109
"quantity": 6,
110
"errors": {
111
"inventory": [],
112
"price": [],
113
"promo": [
114
{
115
"promoChange": true
116
}
117
]
118
}
119
}
Copied!
Error Code: 400
Message: Bad request
Description: You will see this error when the promo is already applied.
1
{
2
"code": "PROMO_ALREADY_APPLIED",
3
"message": "custdash has already been applied."
4
}
Copied!
Response Code: 404
Message: Not Found - Promo not found
Description: You will see this when promo doesn't exist in the system.
1
{
2
"code": "PROMO_NOT_FOUND",
3
"message": "The promo code you entered doesn’t exist."
4
}
Copied!
Error Code: 500
Message: Internal Server Error
Description: You will see this error when the account number is incorrect in the x-site-context (for a multi-tenent client).

Change Log

  • June - 2021
  • July - 2020 First updated
Last modified 1mo ago
Copy link
Contents
Change Log