About the Tax Calculation Provider Service Plugin

Note: This service plugin will be deprecated on September 30, 2025. Use the identical Tax Calculation service plugin in the @wix/ecom module instead.

As a tax calculation provider, you can integrate with Wix to allow merchants to request and use your services on their Wix sites. The tax calculated is then included on the site's cart and checkout pages.

The integration is done via an app in the Wix App Market and by implementing the Tax Calculation Provider Service Plugin. After the app is installed on a site, Wix triggers a call to your service whenever the site needs to calculate tax for a transaction.

Using the service plugin, you can design your app to calculate taxes for different regions and based on various tax groups.

Get started

Follow these steps to begin implementing your service plugin.

Choose a framework

You can implement this service plugin with the following frameworks:

Configure your service plugin

To configure and customize your plugin, you need to provide important information in the service plugin configuration file. You can configure your plugin in the Wix Dev Center. For details, see Tax Calculation Provider Extension Configuration.

Define handler functions

Use taxCalculationProvider.provideHandlers() to define the following handler function that implements your custom business logic.

FunctionRequired
calculateTax()Yes

Code examples

Below is an example for implementing the Tax Calculation Provider service plugin in your code.

CLI: Basic code structure

This is the basic code structure for implementing the Tax Calculation Provider service plugin with the Wix CLI:

Copy
import { taxCalculationProvider } from "@wix/billing/service-plugins"; taxCalculationProvider.provideHandlers({ calculateTax: async (payload) => { const { request, metadata } = payload; // Add your logic here }, });

Self-hosted: Basic code structure

This is the basic code structure for implementing a self-hosted Tax Calculation service plugin:

Copy
import { createClient } from '@wix/sdk'; import { taxCalculationProvider } from '@wix/billing/service-plugins' const wixClient = createClient({ auth: { appId: <YOUR_APP_ID>, publicKey: <YOUR_APP_PUBLIC_KEY> }, modules: { taxCalculationProvider } }); wixClient.taxCalculationProvider.provideHandlers({ calculateTax: async (payload) => { const { request, metadata } = payload; // Add your logic here } }); // Implement a router to process all requests express.post('/plugins-and-webhooks/*', (req, res) => { wixClient.process(req); });

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 service plugin, your app becomes a tax calculator.

See also

Did this help?

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 service plugin 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.

Did this help?