Discount API
Sale price after a percentage or fixed discount, an optional stacked second discount and sales tax.
POST https://api.curatedapi.com/v1/calc/everyday/discount
- Version 1
- MCP tool
calc_everyday_discount - Try it in the browser
Applies a discount (percent or amount), then an optional second percentage discount on the reduced price (the way '20% off, then an extra 10%' works in shops), then sales tax. Each money amount is rounded to the cent and the totals are built from those rounded amounts, so the figures always add up.
Formula
after = price − d₁ − (price − d₁)·p₂; final = after + after·tax
- Amounts are plain numbers in any single currency; no currency conversion is done.
Inputs
Send numbers as strings to keep every digit. options sets precision and rounding (see numbers and rounding).
| Input | Type | Description |
|---|---|---|
price required |
decimal (string) | Original price. Allowed: >= 0 and <= 1000000000000000. Unit: currency. |
discount_percent |
decimal (string) | Discount in percent. Give this or discount_amount. Allowed: >= 0 and <= 100. Unit: percent. |
discount_amount |
decimal (string) | Discount as an amount. Give this or discount_percent. Allowed: >= 0 and <= 1000000000000000. Unit: currency. |
additional_discount_percent |
decimal (string) default 0 |
Second discount applied to the already reduced price. Allowed: >= 0 and <= 100. Unit: percent. |
sales_tax_percent |
decimal (string) default 0 |
Sales tax added after the discounts. Allowed: >= 0 and <= 100. Unit: percent. |
options.rounding |
half_even | half_up | half_down | up | down | ceiling | floor | Rounding mode applied once to each result. Default half_even. |
options.decimals |
integer | Round results to this many digits after the decimal point. |
Result
Under result in the answer, next to exactness, precision, inputs, formula, references and warnings.
| Result | Type | Description |
|---|---|---|
discount_amount | decimal (string) | First discount. Unit: currency. |
additional_discount_amount | decimal (string) | Second discount. Unit: currency. |
price_after_discount | decimal (string) | Price after both discounts. Unit: currency. |
tax_amount | decimal (string) | Sales tax on the discounted price. Unit: currency. |
final_price | decimal (string) | Price after discounts plus tax. Unit: currency. |
total_savings | decimal (string) | Both discounts together. Unit: currency. |
effective_discount_percent | decimal (string) | Total savings as a percent of the price. Unit: percent. |
Examples
25% off 80
curl https://api.curatedapi.com/v1/calc/everyday/discount \
-H "Authorization: Bearer $CURATEDAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"price": "80",
"discount_percent": "25"
}'
{
"calculator": "everyday/discount@1",
"result": {
"discount_amount": "20.00",
"additional_discount_amount": "0.00",
"price_after_discount": "60.00",
"tax_amount": "0.00",
"final_price": "60.00",
"total_savings": "20.00",
"effective_discount_percent": "25.00"
},
"exactness": {
"discount_amount": "exact",
"additional_discount_amount": "exact",
"price_after_discount": "exact",
"tax_amount": "exact",
"final_price": "exact",
"total_savings": "exact",
"effective_discount_percent": "exact"
},
"precision": {
"rounding": "half_even",
"decimals": 2
},
"inputs": {
"price": "80",
"discount_percent": "25",
"additional_discount_percent": "0",
"sales_tax_percent": "0"
},
"formula": "after = price − d₁ − (price − d₁)·p₂; final = after + after·tax",
"references": [
{
"title": "Discounts and allowances",
"url": "https://en.wikipedia.org/wiki/Discounts_and_allowances"
}
],
"warnings": []
}
20% then an extra 10%
curl https://api.curatedapi.com/v1/calc/everyday/discount \
-H "Authorization: Bearer $CURATEDAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"price": "100",
"discount_percent": "20",
"additional_discount_percent": "10"
}'
{
"calculator": "everyday/discount@1",
"result": {
"discount_amount": "20.00",
"additional_discount_amount": "8.00",
"price_after_discount": "72.00",
"tax_amount": "0.00",
"final_price": "72.00",
"total_savings": "28.00",
"effective_discount_percent": "28.00"
},
"exactness": {
"discount_amount": "exact",
"additional_discount_amount": "exact",
"price_after_discount": "exact",
"tax_amount": "exact",
"final_price": "exact",
"total_savings": "exact",
"effective_discount_percent": "exact"
},
"precision": {
"rounding": "half_even",
"decimals": 2
},
"inputs": {
"price": "100",
"discount_percent": "20",
"additional_discount_percent": "10",
"sales_tax_percent": "0"
},
"formula": "after = price − d₁ − (price − d₁)·p₂; final = after + after·tax",
"references": [
{
"title": "Discounts and allowances",
"url": "https://en.wikipedia.org/wiki/Discounts_and_allowances"
}
],
"warnings": []
}
References
Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.
Errors share one format; see errors. Billing, retries and batches work the same for every endpoint.