# Tax Classes

Here you can find an overview of the Emporix API Tax Service, along with its features and benefits.

{% hint style="info" %}

* Looking for code tutorials? Check out the [Tax Service guide](/api-references/api-guides/prices-and-taxes/tax-service/tax.md).
* Looking for API reference? Check out the [Tax Service](/api-references/api-guides/prices-and-taxes/tax-service.md) in the Emporix API Reference.
  {% endhint %}

### Purpose

Based on where your business operates and what types of products you sell, the rates of sales tax may differ. The Emporix Tax Service provides the APIs to help your business cover diverse tax scenarios.

Tax classes are required to set product prices. In order to define a price for an item, you need to have a tax class configured first. You have to define a tax class for each tax rate and for each country you operate in to determine correct tax calculation according to the given country's regulations.\
Then, when setting a price for a product, you need to select the correct tax class for a given country and apply the price for a given site. The system calculates the due tax based on the defined tax classes for the countries you sell in.

For example, on your site you sell books worldwide. In Germany, books are taxable according to `REDUCED` tax class of 7% tax rate. In Ireland, the biding `IE-ZERO` tax class for books is with 0% tax rate. So the gross price for a book in each country is calculated according to the chosen tax classes for the product.

Similarly, tax classes are used in calculating shipping costs or fees, so you need to define a tax class designated to the shipping and other fees your charge, for each country you deliver your goods to.\
In other words, you need to define the tax classes to properly manage prices, display them on the storefront and to enable proper calculations in the cart and checkout.

### Features

The Tax Service API introduces a set of features that make tax management easier:

| Feature                             | Description                                                                                                                                             |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Automatic calculation of prices** | You can automatically calculate net and gross values for prices. See more in the [Automated operations](#automated-operations) section.                 |
| **Customizable tax configurations** | You can create your own tax configurations and adjust them to your business's needs. See more in the [Tax class modeling](#tax-class-modeling) section. |

### Overview

#### Tax class modeling

To minimize data redundancy, tax classes are defined in separate, country-specific configurations and then referenced in applicable products.

You can manage your tax configurations through the [Emporix Tax Service](/api-references/api-guides/prices-and-taxes/tax-service.md) or you can also define them directly in the Management Dashboard, in the **Settings -> Tax** module.\
Learn more in the [Tax](/ce/management-dashboard/settings/tax.md) documentation.

You can create as many tax configurations as you need. Each configuration can be described with the following attributes:

| Mandatory                                                                | Optional                                                                                            |
| ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------- |
| <p>Country code<br><br>Tax class:</p><ul><li>Code</li><li>Rate</li></ul> | <p>Tax class:<br></p><ul><li>Description</li><li>Name</li><li>Order on the tax class list</li></ul> |

Based on the defined tax classes, here's the example pricing:

| Product | Base Price | Country      | Tax Class                                                                       | Final Price |
| ------- | ---------- | ------------ | ------------------------------------------------------------------------------- | ----------- |
| Book A  | EUR 20.00  | Germany (DE) | <p>Reduced:<br><br></p><ul><li>Tax Code: REDUCED</li><li>Tax Rate: 7%</li></ul> | EUR 21.40   |
| Book A  | EUR 20.00  | Ireland (IE) | <p>Zero:<br><br></p><ul><li>Tax Code: IE-ZERO</li><li>Tax Rate: 0%</li></ul>    | EUR 20.00   |

Explanation:

* Base Price: Price of the product before tax.
* Tax Class: A category that groups products with similar tax treatments
* Tax Code: A unique identifier for the tax class in each country.
* Tax Rate: Percentage of tax applied to the base price.
* Final Price: Calculated as Base Price + (Base Price × Tax Rate).

{% hint style="warning" %}
Decide how the product prices are displayed on your storefront. Specify whether all the product prices are shown as gross or net values by updating the given site's `includesTax` parameter. The `true` value means that the site displays gross prices, while the `false` value means the net prices are visible. If the `includesTax` parameter for a site is not defined, the system defaults to the `includesTax` value specified at the given price model level.\
Learn more in the [Site Settings API](/api-references/api-guides/configuration/site-settings-service.md) and in the [Price Service API](/api-references/api-guides/prices-and-taxes/price-service.md) documentation.
{% endhint %}

#### Automated operations

To facilitate your custom implementations of additional B2B workflows, the Tax Service API supports conversion operations for prices. For that purpose, you can use the [Tax calculation](https://github.com/emporix/emporix-documentation-portal/blob/master/content/user-guides/core-commerce/taxes/broken-reference/README.md) endpoint. As an input in the request, you can provide a specific price value, specify the `includesTax` parameter, and provide a source and target tax class. Based on these, in the response you get the calculations of gross, and net price values, tax value, or a price calculated for another country (using a different tax class). The calculations might be helpful in your custom implementations.

Note that the Tax Service allows for calculations that are based on specific values you provide. If you want to make calculations based on the `Price` object, you should use the price matching mechanism of the Price Service.

{% hint style="info" %}
Refer to these resources for more information:

* API guide - [Tax Service API Tutorial](/api-references/api-guides/prices-and-taxes/tax-service/tax.md)
* Price matching - [Price Service Tutorial](/api-references/api-guides/prices-and-taxes/price-service/price.md)
* Cart calculations - [Cart Service Tutorial](/api-references/api-guides/checkout/cart/cart.md)
  {% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.emporix.io/ce/core-commerce/taxes-v2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
