Split a Tax into Components
Goal: one tax that users pick on a line, made of parts that are reported and remitted separately.
Use it when the parts are filed separately (US state, county and district shares; India's CGST and SGST), or a part's rate changes on its own schedule. Otherwise keep a single-rate tax: one rate, typed in, no components.
You need: permission to manage taxes; for the API, an access token and the usual headers (setup). The rates below are illustrative.
| Tax | Component | |
|---|---|---|
| Picked on document lines | Yes | No |
| Rate | Typed in, or the sum of its components | Opening rate plus dated changes |
| On the document | One line, one combined rate | Not shown |
| In the tax report | — | One row per component |
One component can be used by many taxes. Change its rate once and every tax that uses it follows.
In the app
- Go to Settings > Taxes and open the Components tab.
- Click + Component and fill in Name, Component Code and Rate.
- Optional: open Tax report details to change the Kind (a suggestion such as State or Central, or your own label), Country and Region. The country starts as your company's; these only group and filter the tax report.
- Click Save. Repeat for each part.
- Open the Taxes tab and click + Tax (or edit an existing tax).
- Turn on Split into components, then pick each part from Add a component. With two or more parts, use the arrows to set the order: documents list the parts in that order, and of two equal rates the first takes any rounding cent. Current rate shows the combined rate; it can't be typed while the tax is split.
- Click Save Tax.
You can also create a component without leaving the tax form: choose New component at the top of the Add a component list (or + Component if you have none yet).
Turning Split into components off again makes it a single-rate tax with a typed Tax Rate (%).
With the API
Working in your own language? These samples use plain HTTP. For a typed client in TypeScript, Python, Go, Java or PHP, generate one from the OpenAPI spec.
1. Create each component
curl -X POST $BASE/v1/taxes/components \
-H "$AUTH" -H "$PARTNER" -H "$CT" \
-d '{
"code": "US-CA:state",
"name": "California state",
"kind": "state",
"country_code": "US",
"region": "US-CA",
"rates": [ { "rate": "7.25" } ]
}'
Endpoint reference: POST /v1/taxes/components →
Repeat for each part, for example US-CA:san-francisco:county at 0.25 (kind: "county") and US-CA:sf-transit:district at 1.25 (kind: "district"). Keep each response's id.
| Field | Rule |
|---|---|
code | Required. 1–120 of letters, digits, _ . : -. Unique in the company, otherwise TAX_COMPONENT_CODE_EXISTS. Not parsed: any naming scheme works. |
name | Required. Shown in the report. |
kind | Required. Free lowercase label (a-z0-9_, up to 32), e.g. state, central, levy. Used for reporting only; never changes the calculation. |
country_code | Optional. ISO 3166-1 alpha-2, uppercase. Format-checked only. |
region | Optional. ISO 3166-2, e.g. US-CA. Needs country_code and must start with it. |
rates | Required. Exactly one entry without effective_from (the opening rate), at most one per date, up to 50. Rates are decimal strings. |
Geography is optional. These are all valid components:
{ "code": "IN:CGST", "name": "Central GST", "kind": "central", "country_code": "IN", "rates": [ { "rate": "9" } ] }
{ "code": "IN-KA:SGST", "name": "Karnataka SGST", "kind": "state", "country_code": "IN", "region": "IN-KA", "rates": [ { "rate": "9" } ] }
{ "code": "ENV-LEVY", "name": "Environmental levy", "kind": "levy", "rates": [ { "rate": "0.5" } ] }
2. Create the tax with its components
curl -X POST $BASE/v1/taxes \
-H "$AUTH" -H "$PARTNER" -H "$CT" \
-d '{
"tax_name": "Sales tax · San Francisco",
"display_label": "SF sales tax",
"tax_category": "sale",
"tax_value": "0",
"component_ids": ["<state id>", "<county id>", "<district id>"]
}'
Endpoint reference: POST /v1/taxes →
- The tax's rate is the sum of its components: 8.75% here.
tax_valueis required but ignored whencomponent_idsis non-empty. - The order of
component_idsis the order the parts are split and listed in. tax_categoryissale(invoices) orpurchase(bills). Purchase taxes also takeis_recoverable.
3. Use it like any tax
Put the tax's id in a line's item_tax, exactly as for a single-rate tax:
"item_tax": [ { "tax_id": "<tax id>" } ]
The document shows one tax line at the combined rate. Each line's tax is calculated at the combined rate, rounded, then shared across the components in proportion to their rates. A rounding cent goes to the largest remainder, so the parts always add up to the line's tax. On $1,000.00: $87.50 tax, posted as state $72.50, county $2.50 and district $12.50.
4. Read a tax's parts
GET /v1/taxes returns each tax with a components array: the parts in split order, each with component_id, component_code, component_name, component_kind, its rate today and its rates history. A single-rate tax returns an empty array.
{ "tax_name": "Sales tax · San Francisco", "tax_value": "8.75",
"components": [ { "component_code": "US-CA:state", "component_name": "California", "rate": "7.25" } ] }
The list is the whole answer, so a screen can show what a tax is made of without a call per row or reading the component catalog. GET /v1/taxes/{id} returns the same array.
Change the components later
PUT /v1/taxes/{id} with component_ids:
| Send | Result |
|---|---|
| Field left out | Current components kept |
| A list | Components replaced |
[] | Back to a single-rate tax using tax_value |
Documents already saved keep the rates and split they were saved with.
Pitfalls
- Don't encode rates in
display_label("SF tax 8.75%"). The rate changes over time; documents already show the applied rate. - Archiving a component is refused while a tax uses it (
tax_count> 0). Remove it from those taxes first.