Search…
Applying a coupon code
Learn how to apply a coupon code.
You can apply a coupon code to an active shopping cart to encourage sales in your stores by providing discounts on products or shipping costs.
During the checkout process, a customer manually enters a coupon code in your storefront and clicks the Apply button. The API applies the discount associated with the POP (Point-of-Promotion) offer to the cart. The call returns the contents of the cart with the adjusted pricing information.

How to apply a promo code

Send a POST shoppers/me/carts/active request to the Carts resource with the required promoCode query parameter. The request must include a valid anonymous or authenticated customer token. There is no payload associated with this request; the request body is empty.
The request in the following example applies a promotional code value of wb32xjtam. The ID of the cart is 1234567890.
Note: A successful request returns a status code of 200 in the response header. An unsuccessful request returns an error code in the response.
Request sample
Response sample
1
POST https://api.digitalriver.com/v1/shoppers/me/carts/active?promoCode=wb32xjtam
Copied!
1
{
2
"cart": {
3
"id": "1234567890",
4
"lineitems": {
5
"lineitem": {
6
"id": "12765711619",
7
"quantity": "1",
8
"product": {
9
"displayname": "Displayable Product Name",
10
"thumbnailimage": "http://drh1.img.digitalriver.com/DRHM/Storefront/images\n/product/thumbnail/small-product-image.jpg",
11
"_uri": "https://api.digitalriver.com/v1/shoppers/me/products/232054400"
12
},
13
"pricing": {
14
"listprice": {
15
"_currency": "USD",
16
"__text": "24.95"
17
},
18
"listpricewithquantity": {
19
"_currency": "USD",
20
"__text": "24.95"
21
},
22
"salepricewithquantity": {
23
"_currency": "USD",
24
"__text": "14.95"
25
},
26
"formattedlistprice": "$24.95",
27
"formattedlistpricewithquantity": "$24.95",
28
"formattedsalepricewithquantity": "$14.95"
29
},
30
"_uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active /line-items/12765711619"
31
},
32
"_uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active /line-items"
33
},
34
"billingaddress": {
35
"shippingaddress": {
36
"payment": {
37
"name": "Visa",
38
"displayablenumber": "************1111",
39
"expirationyear": "2017"
40
},
41
"shippingmethod": {
42
"code": "142400",
43
"description": "USPS - Priority Mail"
44
},
45
"shippingoptions": {
46
"pricing": {
47
"subtotal": {
48
"_currency": "USD",
49
"__text": "24.95"
50
},
51
"discount": {
52
"_currency": "USD",
53
"__text": "10.00"
54
},
55
"shippingandhandling": {
56
"_currency": "USD",
57
"__text": "0.00"
58
},
59
"tax": {
60
"_currency": "USD",
61
"__text": "0.00"
62
},
63
"ordertotal": {
64
"_currency": "USD",
65
"__text": "14.95"
66
},
67
"formattedsubtotal": "$24.95",
68
"formatteddiscount": "$10.00",
69
"formattedshippingandhandling": "$0.00",
70
"formattedtax": "$0.00",
71
"formattedordertotal": "$14.95"
72
},
73
"_uri": "https://api.digitalriver.com/v1/shoppers/me/shipping-options"
74
},
75
"_uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/shipping-address"
76
},
77
"_uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/billing-address"
78
},
79
"_uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active"
80
}
81
}
82
{
83
"cart": {
84
"id": "1234567890",
85
"lineitems": {
86
"lineitem": {
87
"id": "12765711619",
88
"quantity": "1",
89
"product": {
90
"displayname": "Displayable Product Name",
91
"thumbnailimage": "http://drh1.img.digitalriver.com/DRHM/Storefront/images\n/product/thumbnail/small-product-image.jpg",
92
"_uri": "https://api.digitalriver.com/v1/shoppers/me/products/232054400"
93
},
94
"pricing": {
95
"listprice": {
96
"_currency": "USD",
97
"__text": "24.95"
98
},
99
"listpricewithquantity": {
100
"_currency": "USD",
101
"__text": "24.95"
102
},
103
"salepricewithquantity": {
104
"_currency": "USD",
105
"__text": "14.95"
106
},
107
"formattedlistprice": "$24.95",
108
"formattedlistpricewithquantity": "$24.95",
109
"formattedsalepricewithquantity": "$14.95"
110
},
111
"_uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active /line-items/12765711619"
112
},
113
"_uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active /line-items"
114
},
115
"billingaddress": {
116
"shippingaddress": {
117
"payment": {
118
"name": "Visa",
119
"displayablenumber": "************1111",
120
"expirationyear": "2017"
121
},
122
"shippingmethod": {
123
"code": "142400",
124
"description": "USPS - Priority Mail"
125
},
126
"shippingoptions": {
127
"pricing": {
128
"subtotal": {
129
"_currency": "USD",
130
"__text": "24.95"
131
},
132
"discount": {
133
"_currency": "USD",
134
"__text": "10.00"
135
},
136
"shippingandhandling": {
137
"_currency": "USD",
138
"__text": "0.00"
139
},
140
"tax": {
141
"_currency": "USD",
142
"__text": "0.00"
143
},
144
"ordertotal": {
145
"_currency": "USD",
146
"__text": "14.95"
147
},
148
"formattedsubtotal": "$24.95",
149
"formatteddiscount": "$10.00",
150
"formattedshippingandhandling": "$0.00",
151
"formattedtax": "$0.00",
152
"formattedordertotal": "$14.95"
153
},
154
"_uri": "https://api.digitalriver.com/v1/shoppers/me/shipping-options"
155
},
156
"_uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/shipping-address"
157
},
158
"_uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/billing-address"
159
},
160
"_uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active"
161
}
162
}
Copied!
Typically, the next steps after applying a coupon code are either re-directing the customer to the Digital River hosted checkout to complete the purchase process or submitting the cart and creating an order to complete the checkout process.
Last modified 1yr ago
Copy link