Skip to main content
Tax is calculated on every invoice line when an invoice is priced, and again when you ask for it explicitly through POST /tax/calculations. Which engine does the calculation is set per legal entity: Alguna Tax, where you define the rates and the conditions they apply under, or an external provider (Anrok or Stripe Tax), which determines rates from each line’s tax code and the customer’s address. Use this page to choose between them and to see the API surface; the two subpages cover each engine’s configuration. The selling legal entity is the merchant of record; a group billing from several entities can run a different engine per entity. Customer-side settings — tax_country, tax_id, and a per-customer tax_rate, tax_reason, and tax_type — are on Customer Tax Settings.

Alguna Tax

Built-in, rule-based tax. You define rates by jurisdiction and the taxability reason for each.

External Tax Providers

Connect Anrok or Stripe Tax. The engine determines tax from each line’s tax code and the customer’s location.
Tax codes apply to external providers only. Alguna Tax is driven entirely by the rules you configure, so under it tax does not vary by product.

What appears on an invoice

Whichever engine runs, each invoice line carries tax_rate and tax_amount, and the invoice carries subtotal, tax, and total. unit_price on a line is always tax-exclusive; tax is calculated on top. (POST /tax/calculations can be told the amounts you send already include tax with tax_behavior: "inclusive".) The types of tax Alguna records are vat, gst, hst, pst, qst, igst, jct, sales_tax, service_tax, and lease_tax. Each taxed line also records why it was taxed that way — standard_rated, reverse_charge, zero_rated, customer_exempt, not_collecting, or other — which is what the invoice prints and tax reporting groups by.

Calculate tax through the API

POST /tax/calculations computes tax for line items you send inline, against the legal entity’s configured engine, and stores the result with an id and an expiry. You then pass that tax_calculation_id to POST /invoices to issue an invoice with exactly those lines and amounts — useful when your own checkout shows the customer a total before Alguna knows about the sale. See Calculate tax.

Request

Send an Idempotency-Key so a retry returns the original calculation instead of creating another. See Idempotency.

Response

id, expires_at, total_tax, and one line_items entry per request line with taxable_amount, tax_rate (a percentage across all jurisdictions, e.g. 8.25), tax_amount, tax_type, and tax_reason. Where a jurisdiction taxes only part of a line — Texas taxes 80% of SaaS — taxable_amount is less than the line total.

Issue an invoice from it

Python
The stored lines, tax, and buyer become the invoice, which is issued synchronously and taxed as of the calculation’s tax_date. Leave customer_id empty to mint a guest customer from the calculation, or set it to attach the invoice to an existing customer. A calculation issues once; after expires_at it can no longer be used. GET /tax/calculations lists calculations (filter by consumed, expired, currency, customer_reference, tax_date_gte/lte) and GET /tax/calculations/{id} shows a calculation’s invoice_id and consumed_at. See One-Off Invoices.

Where tax settings live


Next steps

Alguna Tax

Define rates and taxability reasons per jurisdiction.

External Tax Providers

Tax codes and the canonical taxonomy.

Customer Tax Settings

Per-customer tax country, ID, rate, reason, and type.

Multi-Currency

Tax is charged in the invoice currency.