Separate your product catalog from commerce.

Core concepts

How to handle VAT and sales tax calculations.

January 11, 2023 Seth Bindernagel

Developers building ecommerce solutions have to tackle tax calculations at some point in the development process. When they do, the initial research unearths complex discussions and endless links that inevitably create a long list of questions on what to do next. What tax should you apply within a certain jurisdiction where you sell? What logic do you need to calculate tax? How and when does tax get applied to an order? Taxes also impact pricing strategy, particularly if they cause a price to rise above a customer’s expectation. Developers need a tool that supports any price list that their team has created for products that are sold cross-market.

How can a headless, composable commerce service like Commerce Layer help you with VAT calculations? We try to keep it very straight forward to minimize complexity. This primer will help you get started. (NB: What this post does not contain is any specific accounting or legal advice. If you have questions about that, do what is always recommended and contact your accounting or legal advisors.)

What is the difference between VAT and Sales taxes?

VAT is “value-added tax” and is assigned throughout the supply chain where “value” is added. It’s used in many global economies, but not in the United States. It’s important to call out that VAT can differ between B2C and B2B pricing models, With B2C, prices include VAT. In B2B, prices are exposed without VAT. That is calculated on top of the base price. Some tax benefits may exist throughout the supply chain that allow businesses to deduct VAT. (More details on that here.)

Sales Tax is collected at the point of sale from the retail customer. It differs from VAT in that it is not assessed throughout the supply chain. It is calculated based on the sales tax rate of the local jurisdiction and applied to the final price on the order at checkout time.

Selling In the EU

Whether you’re selling goods (digital or physical) or services in the EU, as a member country or as a non-EU member, a number of important tax regulations exist for you to research. They are mostly meant to simplify VAT and make it easy to understand. Again, we recommend that you speak with a tax accountant and legal advisor to learn more about all of the various aspects that impact your business. Some topics you may want to research include:

Most developers who build for multi-market ecommerce have to calculate VAT and sales taxes. Since every jurisdiction has a different revenue collection scheme, the logic required to calculate the tax can get complex. The solution you choose needs to deliver things like:

  • The tax rate in each jurisdiction where an order is placed and where it is being shipped
  • The VAT or sales tax calculation based on that tax rate
  • How to handle cross-border purchases
  • Effective pricing strategies that account for the tax and optimize sales

How do you handle VAT and sales tax with a composable commerce engine such as Commerce Layer?

VAT and sales tax calculations don’t have to be a complex part of the ecommerce experience you build. You can use tools and integrations to help handle most of the tax considerations in the markets where you sell. Commerce Layer supports multi-market tax calculation by:

  • Providing a price list object that helps you segment markets where taxes are included (B2C VAT) or not (B2B VAT or sales tax)
  • Supporting different merchants (aka legal entities) by market, enabling the proper legal entity to collect taxes for reporting
  • Building integrations with third-party tax calculators

Your tax calculations can be handled by our out-of-the-box integrations with Avalara and TaxJar. By connecting those services, you can use the best options available in the market that will handle the calculation for you. In some cases you might need something other than Avalara or TaxJar. If so, use our external tax calculator resource to integrate that tool. Or, you may also need a very simple, elegant solution that doesn’t require tools like these. In that case, use our manual tax calculator resource and write your custom logic. Commerce Layer is highly extensible, so choose the path that is best for you.

Composabe Commerce is all about selecting the best services available to build the digital experience, and then connecting those services together via APIs. Commerce Layer focuses on the technology that powers the transactions on your site, but also on building in key integrations like these to make this as easy as possible.

Frequently Asked Questions with VAT, sales tax, and ecommerce

Should I use a service like Avalara or TaxJar?

Yes. Commerce Layer’s integrations with Avalara and TaxJar are straightforward. Use the API to configure your account and automatically compute tax calculations for all orders within an associated market. We strongly recommend using these services to do all of your tax calculations. They are well documented, best-in-class tools tightly integrated with our platform.

What if I don’t want to use Avalara or TaxJar? Can I use some other service?

You can use Commerce Layer’s External Tax Calculators resource mentioned above and delegate your tax calculation logic to any specified external service.

How does an external tax calculator access the prices to calculate the appropriate tax?

Tax calculators use the order from Commerce Layer to calculate taxes. The factors that determine tax rates included the market (merchant), product type, and customer shipping address. The calculator will return the appropriate tax amount based on the order.

How do you manage different VAT or sales tax categories in one ecommerce shop?

If product categories have different VAT or sales tax rates (e.g. books vs. food vs. other consumer goods), you need to manage different tax categories. Commerce Layer’s TaxJar and Avalara integrations support “tax categories”. That will enable more sophisticated segmentation of tax requirements at the SKU-level if required.

How do you apply taxes to shipping costs and how do you know when you should apply them or not?

TaxJar or Avalara send an API response that Commerce Layer can use to split taxes between an order and shipping costs. Side note, in July 2022, the VAT rules in Europe went through several changes. The changes were meant to simplify the process for ecommerce sellers. Avalara has put together a helpful IOSS (Import One-Stop-Shop) FAQ as well as a directory of VAT tax guides per EU country.

This is why we strongly recommend you leverage Commerce Layer’s integration with either Avalara and TaxJar. They will help you solve these complex issues seamlessly.

How can I dynamically update a price based on a customer’s location and a local government’s VAT or sales tax rate?

The same general answer applies. Both TaxJar and Avalara will make this calculation easier. Taxes need to be updated in the cart at checkout based upon the order. A user will enter their information and the tax calculator integration takes care of the rest.

How can I manage multiple tax schemes on my ecommerce site that include one price for consumers (B2C), but various bulk rate prices for businesses (B2B)? And, how do I calculate VAT across the multiple countries where I ship?

As mentioned, you can specify one Price List per market to determine taxes you need to include and manage international business models with B2B/B2C pricing. For example, with B2C pricing, it is standard in the EU to show the reference price that includes the VAT. The resulting price is typically rounded up, but this adds further complexity. The net revenue will not be rounded and will differ from country to country. This requires you to collect different revenues, provided you use the same reference price across countries. The table shows some examples for your reference. (Consult your tax advisor for actual tax rates and calculations.)

|         	| VAT rate 	| B2C reference price 	| Revenues 	|
|-----------|------------|-----------------------|------------|
| France  	|    20%   	|         100         	|   83.33  	|
| Germany 	|    19%   	|         100         	|   84.03  	|
| Croatia 	|    25%   	|         100         	|   80.00  	|

If you sell in B2B and want a rounded price excluding VAT, the resulting invoiced price will be different from country to country.

|         	| VAT rate 	| B2B reference price 	| Invoice price with VAT 	|
|-----------|------------|-----------------------|--------------------------|
| France  	|    20%   	|         100         	|           120          	|
| Germany 	|    19%   	|         100         	|           119          	|
| Croatia 	|    25%   	|         100         	|           125          	|

With per-market prices lists, you can apply the correct tax for the orders you receive and for the channel you require (B2B vs. B2C).


If you don’t see a question you want answered, and are wondering how Commerce Layer can solve it, please contact us and we will update this post.

Summarizing VAT and sales tax considerations for ecommerce developers

Most ecommerce developers already know about VAT and sales tax. The struggle is how to implement complex logic that is often not provided out of the box by other monolithic solutions that are out there. Issues related to taxes can seem unending.

  • Taxes are different everywhere, subject to change, have local variations, apply differently to promotions and delivery costs.
  • Even with the advice of a tax expert to build the correct taxation logic, how do you push it to the frontend?
  • How do you pick and choose the price to display on the store, depending on the store and user location?
  • How can you design the right ecommerce experience, especially for mixed B2C & B2B stores or international stores?
  • How can you dynamically manage the price component?

All of these issues can be solved with Commerce Layer’s composable commerce approach. You can either easily connect Commerce Layer to your choice of an external service that meets your needs, or use Commerce Layer’s extensive APIs to build your own custom logic.

Contact us.

Tell us about your project. Our team will reach out to you for a personalized offer.