Tax integration template

Learn how to use the tax integration template to integrate with Composable Commerce.

Connect application templates are for development purposes. They require further customization before being used in production projects.

Our tax integration template demonstrates how to integrate Composable Commerce with an external tax service when Carts are updated and when new Orders are created.

Implementation

The two applications within the tax integration template are:

  • Tax calculator: calculates tax using an external tax provider based on the content of a Cart. This application is triggered automatically when a Cart is updated.
  • Order sync: synchronizes Order data with an external tax provider for accounting and compliance purposes, such as filing tax returns.

Integrating a tax service provider with commercetools Connect involves using API Extensions, Subscriptions, and Messages.

The following graph illustrates a high-level overview of how the tax calculator and order sync applications function.

Choose a tax service provider

The first step is to choose an appropriate tax service provider. Consider factors such as ease of use, scalability, pricing, and the availability of APIs for integration. Most modern tax services provide comprehensive APIs and SDKs for this purpose. Once you've selected an tax service provider, set up and configure your account based on your requirements, such as API keys, templates, and domains.

Understand API Extensions, Subscriptions, and Messages

API Extensions are called after the processing of create or update requests, but before the result is persisted in Composable Commerce. In the case of the tax calculator application, this ensures that the Cart update request is only completed when the tax calculator application has received and returned information from the external tax service.

Messages represent a change or an action performed on a resource, for example a Customer or an Order. Previously, you needed to poll the Messages API to retrieve Messages, but you can now subscribe to them with a Subscription and retrieve Messages automatically. The order sync application subscribes to the Order Created Message so it responds asynchronously when a new Order has been created.

Create a Connect application

The tax integration template is a good starting point for developing a Connect application to handle tax calculations. You can customize and extend it according to your specific needs. To complete the integration, you must implement the final API calls to your selected tax service provider.

Within the tax calculator application, you can define postDeploy and preUndeploy scripts to manage its API Extension. The order sync application also has postDeploy and preUndeploy scripts to manage its Subscription. commercetools Connect automatically executes these scripts during the deployment lifecycle.

Conclusion

Integrating an tax service provider with commercetools Composable Commerce using the tax integration template enhances your application capability to engage with customers effectively, while the order sync application can also assist in automating your administrative tasks. By following the steps outlined above and following the best practices, you can set up a robust system for automatically updating tax values.