October 23, 2025·Product
Integrate Avalara (AvaTax) with Medusa
Shahed Nasser

Shahed Nasser
Learn how to integrate Avarlara with Medusa to calculate taxes during checkout. The integration also supports syncing products to Avalara, and creating transactions in Avalara when an order is placed in Medusa.

It's essential for online businesses to manage taxes accurately, to ensure compliance and building customer trust. This becomes even more important for businesses selling across multiple regions, as they must account for varying tax regulations and automate tax calculations.
Medusa provides powerful tax features through its Tax Module, while also allowing you to integrate third-party tax providers for greater flexibility and control over your business’s tax settings. You can integrate providers like Avalara to automatically calculate taxes at checkout, sync your products to Avalara for granular tax calculations and overrides, track transactions for placed orders, and more.
Integrate Avalara with Medusa
Follow this step-by-step guide
How it Works
Tax Calculation with Avalara
Medusa's Tax Module supports integrating third-party providers as Tax Module Providers. The Avalara Tax Module Provider implements the logic to calculate taxes for a cart's line items and shipping methods.
During checkout, Medusa uses the provider under the hood to calculate taxes for the cart using Avalara. Based on the returned rate, Medusa automatically applies the correct taxes.

Create Avalara Transactions for Medusa Orders
You can track your orders in Avalara as transactions, giving you a comprehensive and automated audit trail for tax compliance. Creating transactions in Avalara also reduces the risk of errors during tax audits.
Medusa’s events and orchestration systems make it possible to asynchronously send order data to Avalara when an order is placed. You can create a workflow that generates a transaction in Avalara, then execute that workflow every time an order is placed.
1234567891011121314151617import { SubscriberArgs, type SubscriberConfig } from "@medusajs/framework"import { createOrderTransactionWorkflow } from "../workflows/create-order-transaction"export default async function orderPlacedHandler({event: { data },container,}: SubscriberArgs<{ id: string }>) {await createOrderTransactionWorkflow(container).run({input: {order_id: data.id}})}export const config: SubscriberConfig = {event: "order.placed",}
Now, whenever a customer places an order, you can view its tax details in Avalara as well.
Sync Products to Avalara
Avalara allows you to manage tax configurations at the product level. For example, you can specify a unique classification for a product, and Avalara will use that classification when calculating taxes.
In Medusa, you can create workflows that perform actions across systems. For example, you can create a workflow that retrieves products from your Medusa database and pushes them to Avalara to be stored as items. By using a workflow, you can also define rollback logic that undoes actions performed across systems if an error occurs.
1234567891011121314151617181920export const createProductItemWorkflow = createWorkflow("create-product-item",(input: WorkflowInput) => {const { data: products } = useQueryGraphStep({entity: "product",fields: ["id","title",],filters: {id: input.product_id},})const response = createAvalaraItem({item: {itemCode: products[0].id,description: products[0].title,}})
You can then execute these workflows from subscribers that are triggered when specific events occur, such as when a product is created.
1234567891011121314151617import { SubscriberArgs, type SubscriberConfig } from "@medusajs/framework"import { createProductItemWorkflow } from "../workflows/create-product-item"export default async function productCreatedHandler({event: { data },container,}: SubscriberArgs<{ id: string }>) {await createProductItemWorkflow(container).run({input: {product_id: data.id}})}export const config: SubscriberConfig = {event: `product.created`,}
Whenever you create, update, or delete a product in Medusa, the changes will automatically be reflected in Avalara.
Tutorial: Integrate Avalara with Medusa
This tutorial in the documentation will show you how to:
- Create the Avalara Tax Module Provider responsible for calculating taxes.
- Create transactions in Avalara when an order is placed.
- Sync products to Avalara to manage their tax codes and classifications.
You may also like

October 21, 2025·Product
Medusa Cache benchmarks: 2.2x faster APIs



Oliver Juhl, Adrien de Peretti and Carlos Rodrigues

October 21, 2025·Company
Announcing Medusa Cache



Oliver Juhl, Adrien de Peretti and Carlos Rodrigues

October 14, 2025·User stories
Materialbank.jp: Centralizing B2B sales with a Commerce Operating System


Nicklas Gellner & Carla Böddeker