Skip to content

calculateSalesTax

function calculateSalesTax(amount, options):
| SalesTaxAmounts
| null;

Defined in: salestax.ts:213

Adds sales tax to an amount, or splits it out when inclusive is set.

Give a rate, or a province (and kind, default services, and date) to use the standard rate from getSalesTaxRate. The tax is rounded half up to the paisa.

Parameter Type Description
amount number 0 to 1 trillion rupees
options SalesTaxOptions -

| SalesTaxAmounts | null

The amounts, or null if the amount, rate or province is invalid or no rate applies. Never throws.

calculateSalesTax(1000, { rate: 18 }); // { net: 1000, tax: 180, gross: 1180, rate: 18 }
calculateSalesTax(1000, { province: 'Punjab', date: '2026-11-18' }); // { net: 1000, tax: 160, gross: 1160, rate: 16 }
calculateSalesTax(1150, { province: 'Sindh', date: '2026-11-18', inclusive: true }); // { net: 1000, tax: 150, gross: 1150, rate: 15 }