Skip to navigation

Calculate Cart Tax

View as Markdown
Available on Starter, Pro, and Enterprise Plans

Calculates sales tax per line item for one or more carts. The request body is the same for every merchant, and Ziptax routes on the merchant’s compliance model.

For a TaxCloud-connected merchant, the cart is forwarded to TaxCloud (POST /connections/{connectionId}/carts) using the merchant’s stored credentials, and TaxCloud’s response is returned verbatim. Additional cart fields (items, transactionDate, destination, …) are relayed unchanged. Requires credentials on file; a connected merchant without valid credentials returns 404.

For a self-managed merchant (status external_compliance), Ziptax calculates the tax in-process with its own rate engine and no TaxCloud call. Three differences matter on that path. (1) Calculation only: nothing is persisted, connectionId is omitted from the response, and the returned cartId is a correlation token that cannot be passed to /merchant/order/create-from-cart. (2) tic uses the Ziptax taxability code vocabulary, not TaxCloud’s: 10001 is shipping and 11000 is handling, while TaxCloud’s shipping codes (11010-11015) and the Colorado retail delivery fee code (11098) carry no special meaning and are taxed as ordinary product codes. (3) discounts, exemption, and deliveredBySeller are rejected with 400 rather than ignored, non-USD currency and countryCode CA are rejected, and a cart is capped at 250 line items.

A self-managed request can add taxRateDetail=base to return each line item’s baseRates, the state, county, city and district rates for the address the line was taxed at, next to tax. TaxCloud-connected merchants ignore it.

Every other merchant transaction endpoint returns 403 for a self-managed merchant. See the Self-Managed Cart Calculation guide for the full contract.

Billable API calls: 1 billable API call per distinct address resolved in each cart. When a request contains several carts, each cart counts its own addresses. How billing works

Authentication

X-API-KEYstring
API Key authentication via header

Query parameters

nexusbooleanOptionalDefaults to false

Self-managed merchants only. true limits tax collection to carts whose destination state is one where the merchant has a live physical or economic nexus location recorded through /merchant/nexus. A cart shipped to any other state is returned with rate 0 and amount 0 on every line, and a merchant with no locations recorded is taxed nowhere. When the submitted destination state and ZIP agree on a US state outside the merchant’s nexus, no address is looked up and no geo request is billed. Every other cart (a state that is not a recognized US state code or name, a ZIP that places the address in another state or is not recognized, or a nexus state) is decided by the state the address resolves to; a cart that resolves outside the nexus is also untaxed, and its lookup stays billed. false, or omitted, collects tax in every state. Nexus is read as it stands when the request is made, not as of transactionDate. The name and value are read in any case; a value other than true or false is rejected with 400. TaxCloud-managed merchants ignore it, and it is not forwarded to TaxCloud.

taxRateDetailenumOptionalDefaults to none

Self-managed merchants only. base adds baseRates to every line item, beside tax: the jurisdiction breakdown (state, county, city and district sales and use components) of the rate lookup the line was quoted at, in the shape GET /request/v60 returns. none, or omitted, returns no breakdown. The name and value are read in any case; any other value is rejected with 400. TaxCloud-managed merchants ignore it, and it is not forwarded to TaxCloud.

Allowed values:

Request

This endpoint expects an object.
itemslist of objectsRequired

The carts to calculate tax for. Most integrations send a single cart; up to 100 carts may be calculated in one call.

merchantIdstringRequired
UUID of the merchant whose TaxCloud connection is used. Must be owned by the calling account. Consumed by the Ziptax layer for routing and not forwarded to TaxCloud.
transactionDatedatetimeOptional

RFC3339 datetime the carts are calculated for. Defaults to the current time when omitted. Self-managed merchants: a transactionDate in a past month is quoted from that month’s historical rates, and product rate rules and meal tax are applied as in effect on its calendar date in its own offset; a past month whose tax_table rates the running service has not loaded uses the current tax_table rates, while SST states and other dated sources keep the month, and rate rules and meal tax stay dated on its own day; a value that is not an RFC3339 datetime, or a month older than the historical rates, is rejected with 400 before any cart is calculated.

Response

Calculated carts. For a TaxCloud-connected merchant this is TaxCloud’s response relayed verbatim; for a self-managed merchant it is the Ziptax calculation, which has no connectionId, exemption, or deliveredBySeller.

Cart Calculate Response Bodyobject
OR
Self Managed Cart Calculate Response Bodyobject

Errors

400
Merchant Cart Calculate Body Bad Request Error
401
Merchant Cart Calculate Body Unauthorized Error
403
Merchant Cart Calculate Body Forbidden Error
404
Merchant Cart Calculate Body Not Found Error
413
Merchant Cart Calculate Body Content Too Large Error
422
Merchant Cart Calculate Body Unprocessable Entity Error
429
Merchant Cart Calculate Body Too Many Requests Error
500
Merchant Cart Calculate Body Internal Server Error
502
Merchant Cart Calculate Body Bad Gateway Error
504
Merchant Cart Calculate Body Gateway Timeout Error