Skip to main content

taxes-api

Taxes API

  • Get calculated taxes for an arbitrary amount
    • POST /api/v1/products/taxes
    • Body: \{ "amount": 123.45 \}
    • Auth: required
    • Uses the caller's address.country internally; no country param needed.
    • Response:
      • \{ deductable: number, calculatedTaxes: [\{ key: string, type: 'PERCENT'|'FLAT', value: number, calculatedTax: number \}], finalPrice: number, country: string|null \}

How taxes are computed

  • Taxes are dynamic per country and come from Tax Rules (managed in Admin > Taxes).
  • Keys commonly used: platform_fee, gst, tds, processing_fee.
  • Types:
    • PERCENT: value is a percentage. For gst, it applies on platform_fee amount. For tds, it applies on product price.
    • FLAT: value is a flat currency amount.

Admin setup

  • Use Admin Panel > Taxes to add and edit rules.
  • Backend endpoints:
    • GET /api/admin/tax-rules?country=IN
    • POST /api/admin/tax-rules body: \{ country, key, type, value, active, label \}
    • DELETE /api/admin/tax-rules/:id