Product tax

In this tutorial, you learn how to set product tax for products and product groups in a contract.

  1. From the Oneflow application
  2. From the Public API

Before you begin

From the Oneflow application

Use the Oneflow application to set a tax rate per product and control how the tax label appears in the product table.

Set product tax in the product table

  1. In the product table, click the product price to open the edit dialog.
  1. In Tax rate, enter the tax rate.
  2. Click Save.
📘

Note:

Tax rate is a percentage. Supported values are 0 to 100.

Set the tax label

Use this setting to control the label shown for tax in the product table (for example, VAT).

  1. In the product table, click the menu button in the Price 1 column.
  1. In Tax display, enter the label you want to show (for example, VAT).
  2. Click Save.

From the Public API

The following endpoints support product tax:

  1. Create a contract (set configuration and products when you create the contract)
  2. Update a product by ID (update tax on a single product)
  3. Update a list of product groups (bulk update product group configuration and products)
  4. Update a product group by ID (update configuration for one product group configuration and products)
  5. Add a product to a product group (set tax when you add a product)
  6. Update a product in a product group (update tax for a product inside a product group)

Step 1: Set the tax label

Set the label for the tax column by including tax_1.label inside the configuration object.

Example:

{
  "configuration": {
    "tax_1": {
      "label": "VAT"
    }
  }
}
📘

Note:

If you include tax_1 in the configuration, set label explicitly. If you omit tax_1.label, Oneflow uses Tax as the default label.

Step 2: Set the tax rate for products

Set the tax rate per product price line by setting price_1.tax_1 and price_2.tax_1.

Example:

{
  "products": [
    {
      "id": 470229,
      "name": "shoes",
      "price_1": {
        "base_amount": {
          "amount": "100.00"
        },
        "tax_1": {
          "key": "percentage",
          "value": "25.125"
        }
      },
      "price_2": {
        "base_amount": {
          "amount": "150.00"
        },
        "tax_1": null
      }
    }
  ]
}
📘

Note:

  • You can set tax_1 on both price_1 and price_2.
  • tax_1 is nullable. Use "tax_1": null to remove tax from that price line.
  • If tax_1 is not null, key and value are required. They cannot be null or empty.
  • value supports up to three decimal places.
📘

Note:

Decimal precision rules:

  • The Public API does not validate the number of decimal places in the input tax amount against the defined price_precision. It allows tax amounts with decimal places either fewer or more (up to a maximum of 3) than the defined price_precision.
  • Example: If price_precision is 2, you can provide values such as 1, 1.2, or 1.234 as the tax amount.
  • If you set a tax amount with fewer decimal places than defined in price_precision, the Public API appends trailing zeros when returning values.
  • Example: If price_precision is 3 and you input 1.2 as the tax amount, the Public API returns 1.200 in the response.
📘

Note:

The price_1.tax_1 and price_2.tax_1 percentage value does not depend on the defined price_precision. It supports up to 3 decimal places in the request body. The Public API returns the tax percent in 3 decimal places, adding trailing zeros if the tax percent has fewer than three decimal places or is an integer.

📘

Note:

When Oneflow calculates the total price and tax amounts, it follows the number of decimal places defined by the price_precision of the related product group.