> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # CreateTaxRegion # Package: tax # Namespace: TaxRegionsService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/tax/tax-regions/create-tax-region.md ## Permission Scopes: Manage Orders: SCOPE.DC-STORES.MANAGE-ORDERS ## Introduction Creates a tax region. Tax regions require a tax calculator `appId`. Call List Tax Calculators to retrieve a list of available calculators for a site. Wix uses tax regions to calculate tax. --- ## REST API ### Schema ``` Method: createTaxRegion Description: Creates a tax region. Tax regions require a tax calculator `appId`. Call List Tax Calculators to retrieve a list of available calculators for a site. Wix uses tax regions to calculate tax. URL: https://www.wixapis.com/billing/v1/tax-regions Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: taxRegion, taxRegion.country, taxRegion.appId Method parameters: param name: taxRegion | type: TaxRegion | description: A tax region uses a location to define a specific tax treatment. A location is defined by `country` and `subdivision`. The tax region also dictates whether or not tax is included in the displayed price. | required: true - name: country | type: string | description: 2-letter country code in [ISO-3166 alpha-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format. | required: true - name: subdivision | type: string | description: Subdivision (such as state, prefecture, or province) in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-2) format. - name: appId | type: string | description: The tax calculator GUID to use to calculate tax for this region. Call List Tax Calculators to retrieve a list of available calculators for a site. | required: true - name: taxIncludedInPrice | type: boolean | description: Whether tax is included in the price. Return type: CreateTaxRegionResponse - name: taxRegion | type: TaxRegion | description: Created tax region. - name: id | type: string | description: Tax region GUID. - name: country | type: string | description: 2-letter country code in [ISO-3166 alpha-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format. - name: subdivision | type: string | description: Subdivision (such as state, prefecture, or province) in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-2) format. - name: appId | type: string | description: The tax calculator GUID to use to calculate tax for this region. Call List Tax Calculators to retrieve a list of available calculators for a site. - name: taxIncludedInPrice | type: boolean | description: Whether tax is included in the price. - name: revision | type: string | description: Revision number, which increments by 1 each time the tax region is updated. To prevent conflicting changes, the current revision must be passed when updating the tax region. Ignored when creating a tax region. - name: createdDate | type: string | description: Date and time the tax region was created. - name: updatedDate | type: string | description: Date and time the tax region was last updated. Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: SUBDIVISIONS_NOT_SUPPORTED_FOR_COUNTRY | Description: Subdivisions aren't supported for the specified `country`. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_SUBDIVISION_FORMAT | Description: The `subdivision` format is invalid. It must be in ISO-3166 alpha-2 format. HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: CALCULATOR_ID_NOT_FOUND | Description: Couldn't find the calculator. HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: ALREADY_EXISTS | Description: A tax region with this `country` and `subdivision` already exists. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CALCULATOR_IS_NOT_SUPPORTED_FOR_THIS_TAX_REGION | Description: The calculator doesn't support this tax region. ``` ### Examples ### Create Tax Region Creates a tax region with basic info ```curl curl -X POST \ 'https://www.wixapis.com/billing/v1/tax-regions' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "taxRegion": { "country": "IE", "appId": "7516f85b-0868-4c23-9fcb-cea7784243df", "subdivision": "*" } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.tax.TaxRegionsService.createTaxRegion(taxRegion) Description: Creates a tax region. Tax regions require a tax calculator `appId`. Call List Tax Calculators to retrieve a list of available calculators for a site. Wix uses tax regions to calculate tax. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: taxRegion, taxRegion.country, taxRegion.appId Method parameters: param name: taxRegion | type: TaxRegion | description: A tax region uses a location to define a specific tax treatment. A location is defined by `country` and `subdivision`. The tax region also dictates whether or not tax is included in the displayed price. | required: true - name: country | type: string | description: 2-letter country code in [ISO-3166 alpha-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format. | required: true - name: subdivision | type: string | description: Subdivision (such as state, prefecture, or province) in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-2) format. - name: appId | type: string | description: The tax calculator GUID to use to calculate tax for this region. Call List Tax Calculators to retrieve a list of available calculators for a site. | required: true - name: taxIncludedInPrice | type: boolean | description: Whether tax is included in the price. Return type: PROMISE - name: _id | type: string | description: Tax region GUID. - name: country | type: string | description: 2-letter country code in [ISO-3166 alpha-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format. - name: subdivision | type: string | description: Subdivision (such as state, prefecture, or province) in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-2) format. - name: appId | type: string | description: The tax calculator GUID to use to calculate tax for this region. Call List Tax Calculators to retrieve a list of available calculators for a site. - name: taxIncludedInPrice | type: boolean | description: Whether tax is included in the price. - name: revision | type: string | description: Revision number, which increments by 1 each time the tax region is updated. To prevent conflicting changes, the current revision must be passed when updating the tax region. Ignored when creating a tax region. - name: _createdDate | type: Date | description: Date and time the tax region was created. - name: _updatedDate | type: Date | description: Date and time the tax region was last updated. Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: SUBDIVISIONS_NOT_SUPPORTED_FOR_COUNTRY | Description: Subdivisions aren't supported for the specified `country`. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_SUBDIVISION_FORMAT | Description: The `subdivision` format is invalid. It must be in ISO-3166 alpha-2 format. HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: CALCULATOR_ID_NOT_FOUND | Description: Couldn't find the calculator. HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: ALREADY_EXISTS | Description: A tax region with this `country` and `subdivision` already exists. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CALCULATOR_IS_NOT_SUPPORTED_FOR_THIS_TAX_REGION | Description: The calculator doesn't support this tax region. ``` ### Examples ### createTaxRegion ```javascript import { taxRegions } from '@wix/ecom'; async function createTaxRegion(taxRegion) { const response = await taxRegions.createTaxRegion(taxRegion); }; ``` ### createTaxRegion (with elevated permissions) ```javascript import { taxRegions } from '@wix/ecom'; import { auth } from '@wix/essentials'; async function myCreateTaxRegionMethod(taxRegion) { const elevatedCreateTaxRegion = auth.elevate(taxRegions.createTaxRegion); const response = await elevatedCreateTaxRegion(taxRegion); } ``` ### createTaxRegion (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { taxRegions } from '@wix/ecom'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { taxRegions }, // Include the auth strategy and host as relevant }); async function createTaxRegion(taxRegion) { const response = await myWixClient.taxRegions.createTaxRegion(taxRegion); }; ``` ---