# calculateSalesTax

Source: https://pakdatakit.dev/api/typescript/salestax/functions/calculatesalestax/

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

Defined in: [salestax.ts:213](https://github.com/chmuzamil/pakdatakit/blob/a6eeaa47381308c4e4fcda45b29642fe4fbfb1fc/src/salestax.ts#L213)

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](https://pakdatakit.dev/api/typescript/salestax/functions/getsalestaxrate/). The tax is
rounded half up to the paisa.

## Parameters

| Parameter | Type | Description |
| :------ | :------ | :------ |
| `amount` | `number` | 0 to 1 trillion rupees |
| `options` | [`SalesTaxOptions`](https://pakdatakit.dev/api/typescript/salestax/interfaces/salestaxoptions/) | - |

## Returns

  \| [`SalesTaxAmounts`](https://pakdatakit.dev/api/typescript/salestax/interfaces/salestaxamounts/)
  \| `null`

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

## Example

```ts
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 }
```
