Applying a discount

Learn how to apply discounts

Using the Checkout resource, you can apply discounts to products and services at the item level, checkout level, or on the cost of shipping. You can also create a Checkout that combines two or more of these discount types.

Each type follows the same general rules. You apply the discount as either an amountOff or percentOff. Digital River first applies the discount and then taxes are determined based on the discounted price.

Item-level discount

Apply item-level discounts in the items array. For each element of the array you'd like to discount, set either the percentOff or amountOff parameter. You can also set the optional discount.quantity parameter. This tells Digital River how many items to apply the discount to for that particular skuId.

If you do not specify a discount.quantity, we'll assume you want to apply the discount to the items[]. quantity. For example, if you set theitems[].quantity to 3 and you don't specify a discount.quantity, then, by default, the discount is applied to all three items.

The following POST /checkouts demonstrates both types of item-level discounts:

Percent off request
Amount off request
Percent off request
curl https://api.digitalriver.com/checkouts \
-u sk_test_db9682a2-b04a-4e94-8e11-35fe8ec0b324: \
-d currency=usd \
...
-d items[0][skuId]=09062016 \
-d items[0][price]=10.00 \
-d items[0][quantity]=3
-d items[0][discount][percentOff]=10
-d items[0][discount][quantity]=1
Amount off request
curl https://api.digitalriver.com/checkouts \
-u sk_test_db9682a2-b04a-4e94-8e11-35fe8ec0b324: \
-d currency=usd \
...
-d items[0][skuId]=09062016 \
-d items[0][price]=10.00 \
-d items[0][quantity]=3
-d items[0][discount[amountOff]]=2

In the percent off request, the discount.quantity is set to 1, so the discount is applied to only one of the three items associated with that skuId.

For the amount off request, discount.quantity is not specified, so the discount is applied to all three items .

In the response, for both request types, the items[].amount value is adjusted to reflect the discount and the totalDiscount value shows the discount for the entire order.

Percent off response
Amount off response
Percent off response
...
"totalAmount": 31.18,
"subtotal": 29.0,
"totalFees": 0.0,
"totalTax": 2.18,
"totalDuty": 0.0,
"totalDiscount": 1.0,
"totalShipping": 0.0,
"items": [
{
"skuId": "09062016",
"amount": 29.0,
"quantity": 3,
"discount": {
"percentOff": 10.0,
"quantity": 1
},
"tax": {
"rate": 0.07525,
"amount": 2.18
}
}
],
...
Amount off response
...
"totalAmount": 25.81,
"subtotal": 24.0,
"totalFees": 0.0,
"totalTax": 1.81,
"totalDuty": 0.0,
"totalDiscount": 6.0,
"totalShipping": 0.0,
"items": [
{
"skuId": "09062016",
"amount": 24.0,
"quantity": 3,
"discount": {
"amountOff": 2.0,
"quantity": 3
},
"tax": {
"rate": 0.07525,
"amount": 1.81
}
}
],
...

Checkout-level discount

Use either the discount.percentOff or discount.amountOff parameter to create a Checkout-level discount.

Percent off request
Amount off request
Percent off request
curl https://api.digitalriver.com/checkouts \
-u sk_test_db9682a2-b04a-4e94-8e11-35fe8ec0b324: \
-d currency=usd \
...
-d discount[percentOff]=20
-d items[0][skuId]=09062016 \
-d items[0][price]=10.00 \
-d items[0][quantity]=4 \
-d items[1][skuId]=11141976 \
-d items[1][price]=20.00 \
-d items[1][quantity]=2 \
Amount off request
curl https://api.digitalriver.com/checkouts \
-u sk_test_db9682a2-b04a-4e94-8e11-35fe8ec0b324: \
-d currency=usd \
...
-d discount[amountOff]=10
-d items[0][skuId]=09062016 \
-d items[0][price]=10.00 \
-d items[0][quantity]=4 \
-d items[1][skuId]=11141976 \
-d items[1][price]=20.00 \
-d items[1][quantity]=2 \

In both responses, the amount for all the items is first aggregated, then the discount is applied and finally taxes are calculated.

Percent off response
Amount off response
Percent off response
...
"totalAmount": 68.82,
"subtotal": 64.0,
"totalFees": 0.0,
"totalTax": 4.82,
"totalDuty": 0.0,
"totalDiscount": 16.0,
"totalShipping": 0.0,
"discount": {
"percentOff": 20.0
},
"items": [
{
"skuId": "09062016",
"amount": 40.0,
"quantity": 4,
"tax": {
"rate": 0.07525,
"amount": 2.41
}
},
{
"skuId": "11141976",
"amount": 40.0,
"quantity": 2,
"tax": {
"rate": 0.07525,
"amount": 2.41
}
}
],
...
Amount off response
...
"totalAmount": 75.26,
"subtotal": 70.0,
"totalFees": 0.0,
"totalTax": 5.26,
"totalDuty": 0.0,
"totalDiscount": 10.0,
"totalShipping": 0.0,
"discount": {
"amountOff": 10.0
},
"items": [
{
"skuId": "09062016",
"amount": 40.0,
"quantity": 4,
"tax": {
"rate": 0.07525,
"amount": 2.63
}
},
{
"skuId": "11141976",
"amount": 40.0,
"quantity": 2,
"tax": {
"rate": 0.07525,
"amount": 2.63
}
}
],
...

Shipping discount

The following POST /checkouts demonstrates how to use the shippingDiscount object to apply both discount types:

Percent off request
Amount off request
Percent off request
curl https://api.digitalriver.com/checkouts \
-u sk_test_db9682a2-b04a-4e94-8e11-35fe8ec0b324: \
-d currency=usd \
...
-d items[0][skuId]=09062016 \
-d items[0][price]=10.00 \
-d items[0][quantity]=3
-d shippingChoice[amount]=8.00 \
-d shippingChoice[description]="USPS: Priority (1 day delivery)" \
-d shippingChoice[serviceLevel]= "SG"
-d shippingDiscount[percentOff]=25
Amount off request
curl https://api.digitalriver.com/checkouts \
-u sk_test_db9682a2-b04a-4e94-8e11-35fe8ec0b324: \
-d currency=usd \
...
-d items[0][skuId]=09062016 \
-d items[0][price]=10.00 \
-d items[0][quantity]=3
-d shippingChoice[amount]=8.00 \
-d shippingChoice[description]="USPS: Priority (1 day delivery)" \
-d shippingChoice[serviceLevel]= "SG"
-d shippingDiscount[amountOff]=3.00

In the response, the totalDiscount value reflects the shipping discount amount.

Percent off response
Amount off response
Percent off response
...
"totalAmount": 38.71,
"subtotal": 36.0,
"totalFees": 0.0,
"totalTax": 2.71,
"totalDuty": 0.0,
"totalDiscount": 2.0,
"totalShipping": 8.0,
"items": [
{
"skuId": "09062016",
"amount": 30.0,
"quantity": 3,
"tax": {
"rate": 0.07525,
"amount": 2.26
}
}
],
"shippingChoice": {
"amount": 8.0,
"description": "USPS: Priority (1 day delivery)",
"serviceLevel": "SG",
"taxAmount": 0.45
},
"shippingDiscount": {
"percentOff": 25.0
},
...
Amount off response
...
"totalAmount": 37.64,
"subtotal": 35.0,
"totalFees": 0.0,
"totalTax": 2.64,
"totalDuty": 0.0,
"totalDiscount": 3.0,
"totalShipping": 8.0,
"items": [
{
"skuId": "09062016",
"amount": 30.0,
"quantity": 3,
"tax": {
"rate": 0.07525,
"amount": 2.26
}
}
],
"shippingChoice": {
"amount": 8.0,
"description": "USPS: Priority (1 day delivery)",
"serviceLevel": "SG",
"taxAmount": 0.38
},
"shippingDiscount": {
"amountOff": 3.0
},
...

Combined discount

If you have multiple discounts on a Checkout, item-level discounts are applied first and then checkout-level discounts. Item-level and checkout-level discounts do not reduce shipping costs. If you want to give your customers a break on their shipping costs, you'll need to use the shippingDiscount object.

The following POST /checkouts response shows the order in which discounts are applied:

Response
Response
...
"totalAmount": 35.48,
"subtotal": 33.0,
"totalFees": 0.0,
"totalTax": 2.48,
"totalDuty": 0.0,
"totalDiscount": 15.0,
"totalShipping": 8.0,
"discount": {
"percentOff": 25.0
},
"items": [
{
"skuId": "09062016",
"amount": 36.0,
"quantity": 4,
"discount": {
"percentOff": 10.0,
"quantity": 4
},
"tax": {
"rate": 0.07525,
"amount": 2.03
}
}
],
"shippingChoice": {
"amount": 8.0,
"description": "USPS: Priority (1 day delivery)",
"serviceLevel": "SG",
"taxAmount": 0.45
},
"shippingDiscount": {
"percentOff": 25.0
},
...