TaxService class (accessed via client.tax) estimates the tax for a shipping destination and
a cart before an order is placed, so your storefront can show and charge the final,
tax-inclusive total. When a store has automatic tax enabled, the estimate is calculated for the
destination and itemized per jurisdiction; otherwise the store’s own rate applies.
The endpoint is publishable-key accessible, so you can call it directly from the browser during
checkout. The estimate is a quote only — it is never recorded for tax filing.
For the full picture (how tax flows from preview → order → returns), see the Tax guide.
Methods
previewTax
Estimate the tax for a cart at a shipping destination, without creating an order.
requestBody)
Response
Using the estimate at checkout
Compute the order total from the estimate, then submit that same tax-inclusive total tocreateOrder — the order endpoint
recalculates the tax server-side and confirms the total matches.
tax_source is fallback, apply the store’s configured rate to compute the total; the order
endpoint uses that same rate, so the figures agree.
