Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

Discount Calculator API

Apply one or more percentage discounts in order (each to the already reduced price): final price, total saving and the equivalent single discount.

POST /api/v1/tools/discount-calculatorMCP discount_calculatorCalculators

Find the sale price and how much you save after a percentage discount, including stacked discounts like 25% off then an extra 10% off.

Input

Send these as a JSON object. Unknown fields are rejected.

price
Original price, in currency units. (number, 0 to …, required)
discounts
Comma-separated discount percentages applied in order, e.g. "20" or "20, 10" (20% off, then a further 10%). Each 0 to 100. (string, up to 500 characters, required)
curl https://pithlab.com/api/v1/tools/discount-calculator \n  -H "Authorization: Bearer $PITHLAB_KEY" \n  -H "Content-Type: application/json" \n  -d '{"price":80,"discounts":"25, 10"}'
Example response
{
  "ok": true,
  "result": {
    "price": 80,
    "finalPrice": 54,
    "savings": 26,
    "effectivePercent": 32.5,
    "steps": [
      {
        "percent": 25,
        "before": 80,
        "saving": 20,
        "after": 60
      },
      {
        "percent": 10,
        "before": 60,
        "saving": 6,
        "after": 54
      }
    ],
    "text": "80.00 with 25% then 10% off = 54.00 (you save 26.00, 32.5% in total)"
  }
}