← All tool references

Finance · not_available

Discount Calculator

Calculate a sale price, amount saved, and combined discount when one or two percentage discounts apply.

Open public tool

Overview

Category
Finance
API mode
not_available
Processing
client-side
Privacy
no-data-stored

Public descriptor

The descriptor is available without an API key and supplies this tool’s metadata, schemas, modes, and examples.

GET /api/v1/tools/discount-calculator

View this descriptor as JSON

Execute availability

This tool is documented as a browser capability. Its execute route does not produce a server-side result; when execution is enabled, it responds with browser_interaction_required and points callers to the public tool page.

POST /api/v1/tools/discount-calculator/execute

Authentication is not issued during the preview. A bearer API key is planned for execution after launch.

Input schema

object object; additional properties are not accepted.

original_price · number · required
Enter the original price used in the calculation.
discount_percent · number · required
Enter the first discount used in the calculation.
second_discount_percent · number · optional
Enter the second discount used in the calculation.
sales_tax_percent · number · optional
Enter the sales tax after discount used in the calculation.
{
    "type": "object",
    "properties": {
        "original_price": {
            "type": "number",
            "description": "Enter the original price used in the calculation.",
            "minimum": 0
        },
        "discount_percent": {
            "type": "number",
            "description": "Enter the first discount used in the calculation."
        },
        "second_discount_percent": {
            "type": "number",
            "description": "Enter the second discount used in the calculation.",
            "minimum": 0,
            "maximum": 100
        },
        "sales_tax_percent": {
            "type": "number",
            "description": "Enter the sales tax after discount used in the calculation.",
            "minimum": 0
        }
    },
    "required": [
        "original_price",
        "discount_percent"
    ],
    "additionalProperties": false
}

Output schema

On a successful execution, schema values appear in data.result.values.

sale_price · number
Price after discount produced by the calculation.
savings · number
Amount saved produced by the calculation.
effective_discount · number
Combined discount produced by the calculation.
final_price_with_tax · number
Final price with tax produced by the calculation.
{
    "type": "object",
    "properties": {
        "sale_price": {
            "type": "number",
            "description": "Price after discount produced by the calculation."
        },
        "savings": {
            "type": "number",
            "description": "Amount saved produced by the calculation."
        },
        "effective_discount": {
            "type": "number",
            "description": "Combined discount produced by the calculation."
        },
        "final_price_with_tax": {
            "type": "number",
            "description": "Final price with tax produced by the calculation."
        }
    },
    "additionalProperties": false
}

Discount Calculator example

The request body follows the published input schema. The response below shows the success-envelope shape returned after execution is available.

curl -X POST "https://utilitypages.org/api/v1/tools/discount-calculator/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "original_price": 120,
    "discount_percent": 25,
    "second_discount_percent": 0,
    "sales_tax_percent": 0
}'
{
    "ok": true,
    "data": {
        "slug": "discount-calculator",
        "result": {
            "values": {
                "sale_price": 90,
                "savings": 30,
                "effective_discount": 25,
                "final_price_with_tax": 90
            },
            "display": {
                "display": "90"
            },
            "warnings": [],
            "assumptions": [],
            "steps": []
        }
    },
    "meta": [],
    "request_id": "req_example_123"
}

Errors

api_not_launched · 503
Returned by the current launch gate for every execute request.
invalid_json · 400
Returned when an enabled execute request does not contain valid JSON.
validation_failed · 422
Returned when a request does not satisfy the input schema.
browser_interaction_required · 422
Returned for browser capability tools instead of inventing a server-side result.
tool_not_found · 404
Returned when a requested descriptor slug does not exist.
execution_failed · 503
Returned when an enabled server-side execution cannot complete.