How tax works
- A store either has automatic tax turned on (calculated for the destination) or uses a single manual rate it configures. Either way, the order endpoint is the authority on the tax amount — it recalculates tax server-side and rejects an order whose total doesn’t match, so a tampered total can’t slip through.
- Because the order’s total must already include tax, your storefront previews the tax first (
client.tax.previewTax), shows the shopper the final total, and submits that same total tocreateOrder. - Every order response carries the resolved tax inline —
tax_amount, a per-jurisdictiontax_breakdown, and atax_sourcetelling you how it was produced. There’s no separate “get the tax for this order” call.
Preview tax before checkout
CallpreviewTax with the shipping destination and the cart lines. It returns the tax without creating an order (it’s only an estimate, never recorded), so you can render the final total live as the shopper edits their cart or address. Publishable keys are accepted, so you can call it straight from the browser.
Response
Place the order with the previewed total
Compute the order total from the preview, then submit that exact total. The order endpoint recomputes the tax and confirms the total matches.tax_amount (because you calculate tax elsewhere), it is honored as-is and tax_source is omitted — the server still verifies the total adds up.
When automatic tax isn’t configured
previewTax returns { "tax_source": "fallback" } (no breakdown). Apply the store’s own configured rate to compute the total — the order endpoint uses that same rate, so the totals agree. The same fallback covers a momentary outage: if automatic tax is unavailable while an order is being placed, the order is calculated with the store’s rate and marked tax_source: "fallback" rather than failing, so a sale is never blocked.

