createTaxRate
Requires permission products:tax:create.
Creates a tax rate. The code must not be used by another active tax rate; a clash is refused and names the rate that uses it. Needs the tax create permission.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation CreateTaxRate($input: CreateTaxRateInput!) {
createTaxRate(input: $input) {
id
code
postalCode
name
groupName
type
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation CreateTaxRate($input: CreateTaxRateInput!) {\n createTaxRate(input: $input) {\n id\n code\n postalCode\n name\n groupName\n type\n }\n}",
"variables": {
"input": {
"calculationMethod": "ADDITIVE",
"code": "string",
"country": "string",
"isActive": true,
"isDefault": true,
"jurisdiction": "CITY",
"name": "string",
"rate": 0,
"type": "CARBON_TAX"
}
}
}
EOF
Variables:
{
"input": {
"calculationMethod": "ADDITIVE",
"code": "string",
"country": "string",
"isActive": true,
"isDefault": true,
"jurisdiction": "CITY",
"name": "string",
"rate": 0,
"type": "CARBON_TAX"
}
}
Response:
{
"data": {
"createTaxRate": {
"id": "id",
"code": "string",
"postalCode": "string",
"name": "string",
"groupName": "string",
"type": "string"
}
}
}
createTaxRate(
input: CreateTaxRateInput!
): TaxRate!
Arguments
createTaxRate.input ● CreateTaxRateInput! non-null input
The tax rate's name, code, rate and where it applies.
Type
TaxRate object
A tax rate.