Ask or search…
K

Applying a discount

Learn how to reduce the amount charged to a customer by applying various types of discounts
You can apply multiple types of discounts to a transaction. On this page, you'll find information on how to give:

Types of discounts

Using checkouts or invoices, you can apply discounts to (1) line items, (2) an entire purchase, and (3) shipping costs. You can also combine discount types.
All the discount categories follow the same basic rules. For each, you specify an amountOff or percentOff. Digital River first applies the discount and then determines taxes based on that reduced amount. To determine the aggregate value of all applied discounts, check totalDiscount.

Line item discounts

For each items[] that you want to discount, set either a percentOff or amountOff.
To indicate how many products the discount should be applied to, assign an integer to discount.quantity. If you don't define this parameter, then the discount is applied to the entire quantity of that items[].
In the following percent off request, discount.quantity is 1, so the discount isn't applied to the entire quantity of that items[]. In the amount off request, discount.quantity isn't defined, so the discount is applied to the entire quantity.
Percent off request
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][percentOff]=10
-d items[0][discount][quantity]=1
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 response, each items[].amount is adjusted to reflect the discount and totalDiscount sums up all the markdowns for the transaction.
Percent off response
Amount 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
}
}
],
...
...
"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
}
}
],
...

Entire purchase discounts

To reduce the cost of an entire transaction, define either discount.percentOff or discount.amountOff .
Percent off request
Amount 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 \
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 \
Digital River aggregates all the items[].amount values, applies the discount to arrive at a subTotal and then uses that figure to compute a totalTax.
Percent off response
Amount 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
}
}
],
...
...
"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 cost discounts

You can also apply discounts to shipping costs. The following POST /checkouts demonstrates how to use shippingDiscount to specify either a percentOff or amountOff:
Percent off request
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[percentOff]=25
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
Digital River applies the discount before calculating taxes and totalDiscount includes the shipping cost discount.
Percent off response
Amount 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
},
...
...
"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 discounts

If you include multiple discount types in a request, Digital River first applies any line-item discounts and then the entire purchase markdown. Product and order-level discounts don't reduce shipping costs. If you want to give customers a break on their shipping, you'll need to apply a shipping discount.

Validation errors generated by zero-value discounts

You must send a discount value greater than zero. This applies to all types of discounts.
If you submit a POST /checkouts, POST /checkouts/{id} or POST /invoices and amountOff or percentOff is 0 or less, a 400 Bad Request is returned.
Percent off
Amount off
{
"type": "bad_request",
"errors": [
{
"code": "invalid_discount_percent",
"parameter": "discount",
"message": "The value must be an integer between 0.01 and 100.00 inclusive."
}
]
}
{
"type": "bad_request",
"errors": [
{
"code": "invalid_discount_amount",
"parameter": "discount",
"message": "The value 0.0 is not permitted."
}
]
}