About Tax Calculation SPI

The Tax Calculation SPI allows you to integrate a custom tax calculation service with Wix. Use the Tax Calculation SPI together with the Tax Groups API and the Tax Regions API to customize your tax calculations.

The integration is done via an app created in the Wix Dev Center with the Tax Calculation SPI.

Learn more about implementing an SPI with Wix.

Use case

Terminology

  • Tax Region: A location, defined by country and subdivision with a specific tax treatment. Tax is calculated based on the tax region and the tax group associated with a line item. See the Tax Regions API.
  • Tax Group: A category of products that share the same tax treatment. Tax is calculated based on the tax group and the tax region associated with a line item. See the Tax Groups API.
  • Tax Calculator: An app that is used under the hood to calculate tax for a Wix site. The app calculates tax based on the tax group of the product and the tax region of the sale. By integrating with the Tax Calculation SPI, your app becomes a tax calculator.
Was this helpful?
Yes
No

Configuration

With the Tax Calculation SPI integrated into your app, Wix will call your app with Calculate Tax whenever tax needs to be recalculated on a site. For example, when line items are updated in a cart or checkout. Follow these steps to add the SPI and enable Wix to communicate with your app.

  1. Go to the Extensions tab in the Wix Dev Center.

  2. Click + Create Extension in the top right.

  3. Find Tax Calculation Provider and click + Create.

  4. Use the JSON editor to create the extension's configuration file. Configure the parameters by referencing the table below or the Documentation section to the right of the editor. For each parameter, add the parameter name and value in the JSON editor.

    NameTypeDescription
    deploymentUristringRequired.

    Base URI where the endpoints are called. Wix appends the endpoint path to the base URI.

    For example, to call the Calculate Tax endpoint at https://my-tax-calc.com/v1/calculateTax, the base URI you provide here is https://my-tax-calc.com/.

    calculatorDisplayNamestringDisplay name of the tax calculator.
    unsupportedCountriesarrayList of countries, in ISO-3166 alpha-1 format, that the calculator does not support.
    componentNamestringA unique name for this component. This is an internal name that will only appear in the Dev Center.
  5. Click Test Your App.

Was this helpful?
Yes
No

Sample Use Cases and Flows

This article shares a possible use case your app could support, as well as a sample flow that could support the use case. You aren't limited to these exact flows, but it can be a helpful jumping off point as you plan your app's implementation.

Calculate tax for the United Kingdom

A business operating in the United Kingdom needs to charge and collect tax at different rates throughout the country. Your app can provide the correct tax to charge for their sales.

Follow these steps to create an app that can calculate tax for the United Kingdom.

  1. Configure the SPI and give it a calculatorDisplayName, such as "UK Tax App".

  2. Use Tax Regions API to create or update tax regions for the UK with your app ID in the appId field.

  3. Add logic to your app so that when Wix calls it with Calculate Tax your app returns a tax calculation based on different, relevant tax regions in ISO-3166 alpha-2 format.

  4. [Optional] You may also want to offer additional tax rates based on different categories of products. Use the Tax Groups SPI to configure such tax groups.

Was this helpful?
Yes
No

PostCalculate Tax

Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Calculates tax for the provided line items.

Tax is calculated for each line item based on the tax region in lineItems.taxRegionId and the tax group in lineItems.taxGroupId.

The breakdown of calculated tax returned, includes:

  • taxSummary: The overall total tax calculated.
  • lineItemTaxDetails.taxBreakdown: The tax calculated for each line item in each jurisdiction.
  • lineItemTaxDetails.taxSummary: The total tax calculated for each line item.
Endpoint
POST
{DEPLOYMENT-URI}/v1/calculate-tax
Was this helpful?
Yes
No