Applying a coupon or promo code

Learn how to apply a coupon or promo code.

Coupons or promotional codes encourage store sales by providing discounts on products or shipping costs. You can configure a coupon or promo code offer in Global Commerce and apply that coupon or promo code to an active shopping cart to encourage sales in your stores by providing discounts on products or shipping costs.

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. No payload is associated with this request; the payload could be empty.

The request in the following example applies a promotional code value of wb32xjtam.

Note: A successful request returns a 200 status code in the response header. An unsuccessful request returns an error code in the response.

curl --location --request POST https://api.digitalriver.com/v1/shoppers/me/carts/active?promoCode=wb32xjtam
--header 'authorization: Basic ***\ 
...

Typically, the next steps after applying a coupon or promo code are either redirecting 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.

Primary versus secondary offers

When using a coupon, it's important to note that it's linked to a primary offer which may also have a secondary offer, typically tied to shipping discounts. Each offer has its specific criteria, which can be evaluated separately. A warnings object appears in the response only when neither set of criteria is met. For example, you create a discount offer with a second shipping discount as follows:

  • The primary offer is a $5 discount for Product A.

  • The secondary offer is a 50% shipping discount on orders over $200.

The following table shows when the A warnings object appears.

Discount scenariosDoes the primary offer criteria match?Does the secondary offer criteria matchWarning displayed when applying coupon in the cart

  1. Empty cart

  2. The cart amount is less than $200 and Product A is not in the cart

No

No

Yes

  1. Product A is in the cart

Yes

No

No

  1. The cart amount has reached $200

Yes

Yes

No

  1. The cart amount has reached $200 and the Product A is in the cart

No

Yes

No

Last updated