Tax Rates
Configure state-level tax rates.
Updated
On this page
Overview
DashForDevs supports state-level tax calculation. Tax rates are configured per state in the dashboard.
Calculating Tax
import dash from "@/lib/dash"
const result = await dash.tax.calculate({
state: "TX",
cart_id: dash.cart.cartId,
})
// result = {
// state: "TX",
// state_name: "Texas",
// is_legal: true,
// total_tax: "5.25",
// breakdown: [{ item: "...", tax: "2.63" }, ...],
// illegal_items: []
// }
Quick Cart Tax
const result = await dash.tax.calculateForCart("TX")
const taxAmount = dash.tax.getTotal(result) // 5.25 (number)
Legality Check
Check if products are legal to ship to a state:
const { legal, illegal_items, state_name } = await dash.tax.checkLegality("TX")
if (!legal) {
console.log("Cannot ship to", state_name)
console.log("Illegal items:", illegal_items)
}
REST API
POST /storefront/tax/calculate
X-API-Key: pk_live_your_key
Content-Type: application/json
{ "state": "TX", "cart_id": "cart_xyz" }
Next Steps
- Tax Calculation — Calculation details
- Create Order — Tax in checkout