Configuring taxes
Learn how to configure taxes
During the checkout process, we provide you the ability to indicate whether taxes are included or not included in the product and shipping prices that you provide. This is one of the data points we use to calculate taxes.
While customers are checking out, how taxes should be displayed to them depends on the country.
You can use the checkout's taxInclusive flag to instruct us to either subtract taxes from or add taxes to the checkout's items[].price and shippingChoice.amount.
The default taxInclusive value is false.

Setting tax inclusive prices

If you want us to subtract taxes from the product and shipping prices that you provide, set the checkout's taxInclusive flag to true.
The following POST/checkouts request sets taxInclusive to true, specifies a shippingChoice.amount, and provides the line item's price.
POST/checkouts
1
curl --location --request POST 'https://api.digitalriver.com/checkouts' \
2
...
3
--data-raw '{
4
"currency": "USD",
5
"taxInclusive": true,
6
"email": "[email protected]",
7
"shipTo": {
8
"address": {
9
"line1": "10380 Bren Road W",
10
"city": "Minnetonka",
11
"postalCode": "55343",
12
"state": "MN",
13
"country": "US"
14
},
15
"name": "John Doe"
16
},
17
"shipFrom": {
18
"address": {
19
"country": "US"
20
}
21
},
22
"shippingChoice": {
23
"amount": 5,
24
"description": "standard",
25
"serviceLevel": "SG"
26
},
27
"items": [
28
{
29
"skuId": "ed7b06bd-7b2e-4525-9156-cd6fcbe7fe42",
30
"quantity": 2,
31
"price": 10
32
}
33
]
34
}'
Copied!
Once you submit this request, we compute shipping and line item taxes. We then subtract the computed values from the prices you provided in the request.
In the response, we provide an updated shippingChoice.amount and the computed shippingChoice.taxAmount. We do the same for the checkout's line items.
The checkout's subtotal is the pre-tax price of the line items and shipping. The totalTax is determined by aggregating the shipping and line item taxes.
Checkout
1
{
2
"id": "7ffe373b-b358-4c76-8210-5dc118ce77ae",
3
...
4
"totalAmount": 25.03,
5
"subtotal": 23.28,
6
"totalFees": 0.0,
7
"totalTax": 1.75,
8
"totalImporterTax": 0.0,
9
"totalDuty": 0.0,
10
"totalDiscount": 0.0,
11
"totalShipping": 4.68,
12
"items": [
13
{
14
"id": "1d99324f-6afa-4a90-808b-9d1234e2fc92",
15
"skuId": "ed7b06bd-7b2e-4525-9156-cd6fcbe7fe42",
16
"amount": 18.6,
17
"quantity": 2,
18
"tax": {
19
"rate": 0.07525,
20
"amount": 1.4
21
},
22
"importerTax": {
23
"amount": 0.0
24
},
25
"duties": {
26
"amount": 0.0
27
},
28
"fees": {
29
"amount": 0.0,
30
"taxAmount": 0.0
31
}
32
}
33
],
34
"shippingChoice": {
35
"amount": 4.68,
36
"description": "standard",
37
"serviceLevel": "SG",
38
"taxAmount": 0.35
39
},
40
...
41
}
Copied!

Setting tax exclusive prices

If you want us to add taxes to the product and shipping prices that you provide, set the checkout's taxInclusive flag to false.
The following POST/checkouts request sets taxInclusive to false, specifies a shippingChoice.amount, and provides the line item's price.
POST/checkouts
1
curl --location --request POST 'https://api.digitalriver.com/checkouts' \
2
...
3
--data-raw '{
4
"currency": "USD",
5
"taxInclusive": false,
6
"email": "[email protected]",
7
"shipTo": {
8
"address": {
9
"line1": "10380 Bren Road W",
10
"city": "Minnetonka",
11
"postalCode": "55343",
12
"state": "MN",
13
"country": "US"
14
},
15
"name": "John Doe"
16
},
17
"shipFrom": {
18
"address": {
19
"country": "US"
20
}
21
},
22
"shippingChoice": {
23
"amount": 5,
24
"description": "standard",
25
"serviceLevel": "SG"
26
},
27
"items": [
28
{
29
"skuId": "ed7b06bd-7b2e-4525-9156-cd6fcbe7fe42",
30
"quantity": 2,
31
"price": 10
32
}
33
]
34
}'
Copied!
Once you submit this request, we compute shipping and line item taxes and return them in the shippingChoice.taxAmount and the items[].tax.amount .
Note that the shippingChoice.amount remains the same as the value sent in the request. Likewise, the line item's amount equals its aggregated price from the request.
The checkout's subtotal is the pre-tax price of the line items and shipping. The totalTax is determined by aggregating shipping and line item taxes.
Checkout
1
{
2
"id": "288ef50f-6b23-40ae-a8ad-3048b7f99ccf",
3
...
4
"totalAmount": 26.89,
5
"subtotal": 25.0,
6
"totalFees": 0.0,
7
"totalTax": 1.89,
8
"totalImporterTax": 0.0,
9
"totalDuty": 0.0,
10
"totalDiscount": 0.0,
11
"totalShipping": 5.0,
12
"items": [
13
{
14
"id": "b5125c43-dc3b-4da4-a299-d8d0734f2873",
15
"skuId": "ed7b06bd-7b2e-4525-9156-cd6fcbe7fe42",
16
"amount": 20.0,
17
"quantity": 2,
18
"tax": {
19
"rate": 0.07525,
20
"amount": 1.51
21
},
22
"importerTax": {
23
"amount": 0.0
24
},
25
"duties": {
26
"amount": 0.0
27
},
28
"fees": {
29
"amount": 0.0,
30
"taxAmount": 0.0
31
}
32
}
33
],
34
"shippingChoice": {
35
"amount": 5.0,
36
"description": "standard",
37
"serviceLevel": "SG",
38
"taxAmount": 0.38
39
},
40
...
41
}
Copied!
Last modified 2mo ago