Post Cart Promotion Items

Add applied promotion items to the cart.

1POST /v2/cpq/carts/{cart_ID}/promotions

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User Technical Details.

For additional information, ​see UserSecurity Class and CPQ and Digital Commerce Changes for Guest Users.

Remote Method 

1postCartsPromoItems

REST Handler 

1APIPromotionsCartsCpqV2

Apex Remote Service 

1CpqAppHandler

Apex Remote Input Map 

1{
2 "items": [{
3  "itemId": "a2ff4000000Li5eAAC"
4 }],
5 "promotionId": "a2ff4000000Li5eAAC",
6 "cartId": "801f40000012NEIAA2",
7 "methodName": "postCartsPromoItems"
8}

Package 

Communication (vlocity_cmt)

API Parameters and Response Format 

For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information 

Response FormatJSON
Resource URL/services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/promotions

Example Request 

1POST
2/services/apexrest/vlocity_cmt/v2/cpq/carts/801f40000012NEIAA2/promotions
3
4BODY:
5{
6  "items": [
7    {
8      "itemId": "a2ff4000000Li5eAAC"
9    }
10  ],
11  "promotionId": "a2ff4000000Li5eAAC",
12  "cartId": "801f40000012NEIAA2",
13  "methodName": "postCartsPromoItems"
14}

Example Response 

1{
2 "totalSize": 0,
3 "messages": [],
4 "actions": {
5  "itempricesupdated": {
6   "rest": {
7    "params": {},
8    "method": "GET",
9    "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/801f40000012NEIAA2/price"
10   },
11   "remote": {
12    "params": {
13     "cartId": "801f40000012NEIAA2",
14     "methodName": "getCartLineItemPrices"
15    }
16   },
17   "client": {
18    "params": {}
19   }
20  },
21  "itemadded": {
22   "rest": {
23    "params": {},
24    "method": null,
25    "link": null
26   },
27   "remote": {
28    "params": {}
29   },
30   "client": {
31    "params": {
32     "items": [{
33      "message": "TestProd-7 has been auto-added to the cart.",
34      "Id": null
35     }]
36    }
37   }
38  },
39  "rootitemadded": {
40   "rest": {
41    "params": {},
42    "method": null,
43    "link": null
44   },
45   "remote": {
46    "params": {}
47   },
48   "client": {
49    "params": {},
50    "records": [{
51       "messages": [],
52       "actions": {
53        "addtocart": {
54         "rest": {
55          "params": {},
56          "method": null,
57          "link": null
58         },
59         "remote": {
60          "params": {
61           "methodName": "postCartsItems",
62           "items": [{
63            "quantity": 1,
64            "parentId": "802f4000000CuauAAC",
65            "itemId": "01uf4000000sXvTAAU"
66           }],
67           "cartId": "801f40000012NEIAA2",
68           "price": true,
69           "validate": true,
70           "includeAttachment": false,
71           "pagesize": 20,
72           "lastRecordId": null,
73           "query": null
74          }
75         },
76         "client": {
77          "params": {}
78         }
79        },
80        "updateitems": {
81         "rest": {
82          "params": {},
83          "method": null,
84          "link": null
85         },
86         "remote": {
87          "params": {
88           "methodName": "putCartsItems",
89           "items": [{
90            "itemId": "802f4000000CuauAAC"
91           }],
92           "filters": null,
93           "fields": null,
94           "cartId": "801f40000012NEIAA2",
95           "price": true,
96           "validate": true,
97           "includeAttachment": false,
98           "pagesize": 20,
99           "lastRecordId": null,
100           "query": null
101          }
102         },
103         "client": {
104          "params": {}
105         }
106        },
107        "deleteitem": {
108         "rest": {
109          "params": {},
110          "method": null,
111          "link": null
112         },
113         "remote": {
114          "params": {
115           "methodName": "deleteCartsItems",
116           "id": "802f4000000CuauAAC",
117           "filters": null,
118           "fields": null,
119           "cartId": "801f40000012NEIAA2",
120           "price": true,
121           "validate": true,
122           "includeAttachment": false,
123           "pagesize": 20,
124           "lastRecordId": null,
125           "query": null
126          }
127         },
128         "client": {
129          "params": {}
130         }
131        },
132        "configdelete": {
133         "rest": {
134          "params": {},
135          "method": null,
136          "link": null
137         },
138         "remote": {
139          "params": {
140           "methodName": "configDeleteItem",
141           "id": "802f4000000CuauAAC",
142           "cartId": "801f40000012NEIAA2"
143          }
144         },
145         "client": {
146          "params": {}
147         }
148        },
149        "cloneitem": {
150         "rest": {
151          "params": {},
152          "method": null,
153          "link": null
154         },
155         "remote": {
156          "params": {
157           "methodName": "cloneItems",
158           "items": [{
159            "itemId": "802f4000000CuauAAC"
160           }],
161           "id": "802f4000000CuauAAC",
162           "cartId": "801f40000012NEIAA2"
163          }
164         },
165         "client": {
166          "params": {}
167         }
168        },
169        "modifyattributes": {
170         "rest": {
171          "params": {},
172          "method": null,
173          "link": null
174         },
175         "remote": {
176          "params": {
177           "methodName": "putItemAttributes",
178           "items": [{
179            "itemId": "802f4000000CuauAAC"
180           }],
181           "filters": null,
182           "itemId": "802f4000000CuauAAC",
183           "id": "802f4000000CuauAAC",
184           "cartId": "801f40000012NEIAA2"
185          }
186         },
187         "client": {
188          "params": {}
189         }
190        },
191...
192EXAMPLE TRUNCATED FOR BREVITY