Creating Tax Code
Endpoint: POST /admin/tax_codes
Purpose
This endpoint allows administrators to create a new tax code, specifying the tax calculation method—either as a flat rate or via an external API. It enables businesses to define and apply region-specific or global tax logic.
Path Parameters
This endpoint does not require any path parameters.
Query Parameters
This endpoint does not require any query parameters.
Use Case
An admin sets up a new tax code to govern how taxes are calculated and applied to orders. This is useful for ensuring tax compliance and customizing rate application across geographies or product types.
{
"tax_code": {
"id": "TAX_CODE_ID", // optional, auto-generated if omitted
"name": "TAX_CODE_NAME",
"label": "TAX_LABEL",
"method": "FLAT_RATE", // or "API"
"rate": TAX_RATE, // required if method == FLAT_RATE
"api": "API_PROVIDER_NAME" // required if method == API
}
}
Response
The response returns the created tax code, showing its internal and display identifiers, calculation method, rate, priority, and default status. This confirms successful setup of the tax rule, ready for use in transactions.
{
"tax_code": {
"id": TAX_CODE_ID,
"name": "TAX_CODE_NAME",
"label": "TAX_LABEL",
"description": "TAX_DESCRIPTION",
"rate": TAX_RATE,
"resolver_type": "RESOLVER_TYPE", // flat or api
"priority": PRIORITY_LEVEL,
"is_default": IS_DEFAULT
}
}