# Tax integration template Learn how to use the tax integration template to integrate a tax service provider. Connect application templates are for development purposes. They require further customization before being used in production projects. Our [tax integration template](https://github.com/commercetools/connect-tax-integration-template) demonstrates how to integrate 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 Connect involves using [API Extensions](/api/projects/api-extensions.md), [Subscriptions](/api/projects/subscriptions.md), and [Messages](/api/projects/messages.md). The following graph illustrates a high-level overview of how the tax calculator and order sync applications function. ```mermaid flowchart LR User[User] subgraph composable_commerce[Composable Commerce] Cart[Cart] Order[Order] APIExtension[API Extension] Subscription[Subscriptions] Cart <--> APIExtension Order -- Generates Message --> Subscription end subgraph commercetools_connect[Connect] Tax_connector[Tax calculator] Order_connector[Order sync] end Tax_provider[External tax service] User -- Update --> Cart User -- Create --> Order APIExtension <--> Tax_connector Subscription -- Receives Messages --> Order_connector Tax_connector <--> Tax_provider Order_connector --> Tax_provider ``` ### 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](/api/projects/api-extensions.md) are called after the processing of create or update requests, but before the result is persisted. 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](/api/projects/messages.md) 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](/api/projects/subscriptions.md) and retrieve Messages automatically. The order sync application subscribes to the [Order Created](/api/projects/messages/cart-order-messages.md#order-created) Message so it responds asynchronously when a new Order has been created. ### Create a Connect application The [tax integration template](https://github.com/commercetools/connect-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`](https://github.com/commercetools/connect-tax-integration-template/blob/main/tax-calculator/src/connectors/post-deploy.js) and [`preUndeploy`](https://github.com/commercetools/connect-tax-integration-template/blob/main/tax-calculator/src/connectors/pre-undeploy.js) scripts to manage its API Extension. The order sync application also has [`postDeploy`](https://github.com/commercetools/connect-tax-integration-template/blob/main/order-syncer/src/connectors/post-deploy.js) and [`preUndeploy`](https://github.com/commercetools/connect-tax-integration-template/blob/main/order-syncer/src/connectors/pre-undeploy.js) scripts to manage its Subscription. Connect automatically executes these scripts during the deployment lifecycle. ## Conclusion Integrating a tax service provider 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. ## Related pages - [Area overview page with navigation](/connect.md) - [Previous page: Product export](/connect/templates/product-export.md) - [Next page: Transactional emails](/connect/templates/transactional-emails.md) - [Search documentation and API specs](/search.md)