VAT and sales tax
vat_sales_taxCalculate European Value Added Tax (VAT) and global sales taxes in either Add Mode (Net price to Gross price) or Remove Mode (Gross price to Net price) with statutory rate verification.
Behavior: Deterministic, idempotent calculation with zero external side effects. In 'add' mode: Tax = Amount * (Rate / 100), Total = Amount + Tax. In 'remove' mode: Net = Amount / (1 + Rate / 100), Tax = Amount - Net. Returns exact net, tax amount, and gross values rounded to 2 decimal places.
Usage Guidelines: Use for e-commerce, international invoicing, retail pricing, and VAT compliance calculations. Do not use for restaurant tipping and bill splits; use tip_splitter instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Calculation mode: 'add' to append tax to net amount, or 'remove' to extract embedded tax from gross amount. | add |
| amount | Yes | Base monetary amount to calculate tax on (net amount in 'add' mode, gross price in 'remove' mode). Must be positive. | |
| as_of_date | Yes | Civil date YYYY-MM-DD. Selects the rule pack in force on that date. Required: the engine will not assume a date. | |
| vatRatePercent | Yes | VAT or sales tax rate in percent (0-100). |