Calculate order totals
When you create orders, you can view order details and receipts using the Orders app on the Merchant Dashboard for your test merchant. The order receipt displays the order total breakdown.
The following example shows how to calculate order totals.
NOTE
When rounding decimal amounts smaller than a cent, such as tax per line item, calculate rounding with the round half up rule. For example, the rounding value of $33.654 is $33.65 and the rounding value of $33.455 is $33.46.
Step 1: Line item calculations
Starting with the line item price, add any modifier costs.
In the following table, the cost of the Avocado
and Tofu
modifiers are $1.00 each. When you add the price of these modifiers to the Caesar Salad
price, the subtotal with modifiers is $14.00 ($12.00 + $1.00 + $1.00). Similarly, the Greek Salad
subtotal with modifiers is $12.00 ($10.00 + $1.00 + $1.00).
Line item | Price | Modifiers | Cost | Subtotal with modifiers |
---|---|---|---|---|
Caesar Salad | $12.00 | Avocado Tofu | $1.00 $1.00 | $14.00 |
Greek Salad | $10.00 | Avocado Tofu | $1.00 $1.00 | $12.00 |
Step 2: Line item discounts
From the line item subtotal with modifiers:
- Subtract any percentage discounts, and then
- Subtract any numerical discounts.
In the following table, the value of the Lunch deal
line item discount is $1.00. When you apply this discount to the Caesar Salad
subtotal, the new subtotal after discounts is $13.00 ($14.00 - $1.00).
The value of the 25% off select salads
line item discount is 25% of the.Greek Salad
subtotal (25% of $12.00 = $3.00). When you apply this discount to the Greek Salad
subtotal, the new subtotal after discounts is $9.00 ($12.00 - $3.00).
Line item | Subtotal | Line item discounts | Value | Subtotal after discounts |
---|---|---|---|---|
Caesar Salad | $14.00 | Lunch deal | $1.00 | $13.00 |
Greek Salad | $12.00 | 25% off select salads | $3.00 | $9.00 |
$22.00 |
Step 3: Order-level discounts
From the subtotal after line item discounts:
- Subtract any order-level percentage discounts and then
- Subtract any order-level numerical discounts.
In the following table, the value of the 15th visit 15% off
order-level discount is 15% of each line item subtotal. When you subtract this discount from the Caesar Salad
subtotal, the new subtotal after order-level discounts is $11.05 ($13.00 - $1.95). Similarly, the Greek Salad
subtotal after order-level discounts is $7.65 ($9.00 - $1.35).
Line item | Subtotal | Order level discounts | Value | Subtotal after discounts |
---|---|---|---|---|
Caesar Salad | $13.00 | 15th visit 15% off | $1.95 | $11.05 |
Greek Salad | $9.00 | $1.35 | $7.65 | |
$18.70 |
Step 4: Service charges
To the subtotal after order-level discounts, add any service charges.
In the following table, apply a service charge of 5% to the order subtotal after order-level discounts.
Subtotal | Service charge rate | Service charge collected |
---|---|---|
$18.70 | 5% | $0.94 |
Step 5: Taxes
To retrieve tax rates for order line items, send a GET
request to /v3/merchants/{mId}/orders/{orderId}/line_items?expand=taxRates
.
{
"elements": [
{
...
"name": "Greek Salad",
"price": 1000,
...
"taxRates": {
"elements": [
{
"id": "6HA0Z3Z5DPCBC",
...
"name": "Tax B",
"rate": 500000 // 5% tax applied to Greek Salad
}
]
}
},
{
...
"name": "Caesar Salad",
"price": 1200,
...
"taxRates": {
"elements": [
{
"id": "77FAGR71YYD5M", // tax rate object
...
"name": "Tax A",
"rate": 1000000 // 10% tax applied to Caesar Salad
}
]
}
}
],
"href": "http://sandbox.dev.clover.com/v3/merchants/{mId}/orders/{orderId}/line_items?limit=100"
}
IMPORTANT
If
vat
is set totrue
in the merchant properties, the merchant uses a value-added tax. This means the tax amount is already included in the line item total and no additional amount should be added for tax.
Using the subtotal after order-level discounts (Step 3), calculate tax rates per taxable line item.
In the following table:
- Apply a 10%
Tax A
tax toCaesar Salad
- Apply a 5%
Tax B
tax toGreek Salad
Line item | Subtotal after discounts | Tax | Tax rate | Tax collected |
---|---|---|---|---|
Caesar Salad | $11.05 | Tax A | 10% | $1.11 |
Greek Salad | $7.65 | Tax B | 5% | $0.38 |
$1.49 |
NOTE
If multiple line items in an order are taxed using the same tax rate object, Clover calculates taxes on the subtotal of those items. In the above example, if the same
Tax A
object of 10% is applied to the $11.05 and $7.65 values, calculate tax on the sum of these values.($11.05 + $7.65) * 0.10) = $1.87
See Tax Reports: Examples for more information about calculating taxes for line items.
Step 6: Order total
The order total is the sum of the subtotal after any discounts, taxes, and service charges, if any.
In the following table, the order total is $21.51 ($18.70 + $1.87 + $0.94).
Subtotal after discounts | Taxes | Service charges | Total |
---|---|---|---|
$18.70 | $1.49 | $0.94 | $21.13 |
Apply multiple tax rates to line items
A line item can have multiple tax rates. In the following table, each line item has the Tax A
and Tax B
applied to it.
Line item | Subtotal after discounts | Tax | Tax rate | Tax collected |
---|---|---|---|---|
Caesar Salad | $11.05 | Tax A | 10% | $1.11 |
Tax B | 5% | $0.55 | ||
Greek Salad | $7.65 | Tax A | 10% | $0.77 |
Tax B | 5% | $0.38 | ||
$2.81 |
See Tax Reports: Examples for more examples of different use cases for calculating line item tax calculations.
Updated about 1 year ago