Calculate Tax Rates Via Webhook
A webhook-based tax calculator API that lets you query standard and current tax rates for various commodities, and set custom tax rates on demand.
Overview
This workflow exposes a Tax Calculator API via a webhook endpoint. By sending POST requests to the webhook URL, you can query standard tax rates, retrieve current active rates, and set custom tax rates for various commodities such as Alcohol, Food, Literature, Transport, and more.
Supported Actions
| Action | Description | Required Fields |
|---|---|---|
getStandardTaxRate | Returns the default tax rate for a given commodity | action, commodity |
getCurrentTaxRate | Returns the active tax rate, factoring in any custom rates that have been set | action, commodity |
setCustomTaxRate | Sets a custom tax rate for a specific commodity (stored with a timestamp) | action, commodity, rate |
How It Works
- Webhook Trigger — The workflow starts when a POST request is received at the webhook URL.
- Code Node — A code node processes the incoming payload, resolves the commodity, and performs the requested action (query or update). It returns the result as a JSON response.
If no valid action is provided, the workflow runs in demo mode and returns a set of sample results based on a predefined test scenario.
Supported Commodities
- Default
- Alcohol
- Food
- FoodServices
- Literature
- Transport
- CulturalServices
Example Payloads
1. Get Standard Tax Rate
{ "action": "getStandardTaxRate", "commodity": "Alcohol" }
2. Get Current Tax Rate
{ "action": "getCurrentTaxRate", "commodity": "Food" }
3. Set a Custom Tax Rate and Then Fetch It
You can batch multiple operations in a single request using the operations array:
{ "operations": [ { "action": "setCustomTaxRate", "commodity": "Literature", "rate": 0.08 }, { "action": "getCurrentTaxRate", "commodity": "Literature" } ] }
Standard Tax Rate Reference
| Commodity | Standard Rate |
|---|---|
| Default | 25% |
| Alcohol | 25% |
| Food | 12% |
| FoodServices | 12% |
| Literature | 6% |
| Transport | 6% |
| CulturalServices | 6% |
Tips
- Custom rates override standard rates once set. The
getCurrentTaxRateaction automatically considers any custom rate that is active as of the current date and time. - When setting a custom rate, you can optionally include a
datefield (ISO 8601 format) to specify when the rate should take effect. - If you send a request without an
actionoroperationsfield, the workflow will return demo results to help you understand the response format.
Want to showcase your own workflows?
Become a Needle workflow partner and turn your expertise into recurring revenue.
