Finance Utilities

Calculate Discount

Calculates discounted prices from original amounts and percentage rates. Use via MCP in Cursor or Windsurf, or call GET /v1/finance/discount with original_price and discount_percentage parameters. Returns the final price after discount — if you pass $100 with 20% discount, you get $80. Essential for e-commerce calculations and financial modeling in AI agents.

API Endpoint

GET /v1/finance/discount

Code Examples

curl "https://tinyfn.io/v1/finance/discount" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/finance/discount', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/finance/discount',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's finance tools:

{
  "mcpServers": {
    "tinyfn-finance": {
      "url": "https://tinyfn.io/mcp/finance",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I calculate a discounted price with percentage off?

Pass the original_price and discount_percentage to get the final amount. For $50 with 25% off: original_price=50, discount_percentage=25 returns $37.50.

What's the difference between discount percentage and discount amount?

This tool uses percentage-based discounts (e.g., 20% off). It calculates the final price after applying the percentage reduction to the original amount.

Can I use this discount calculator in MCP-enabled AI coding assistants?

Yes, it works in Cursor, Claude Code, GitHub Copilot, Windsurf, Cline, OpenClaw, and Zed via MCP. Perfect for building pricing logic in e-commerce applications.

Does the discount calculator handle edge cases like 0% or 100% discounts?

Yes. 0% discount returns the original price unchanged, while 100% discount returns $0. Handles fractional percentages accurately.

What format does the discount API return results in?

Returns JSON with the calculated discounted price as a numeric value, typically rounded to 2 decimal places for currency precision.

Try Calculate Discount Now

Get your free API key and start using Calculate Discount in seconds.

Get Free API Key