Agent Wranglers

PAY-46Recommended

Calculate tax with a tax service

Calculate VAT and sales tax with a tax service, or sell through a merchant of record, instead of rates written in code. For physical goods, calculate from the delivery address, and again each time the address, the cart or the shipping method changes.

How to do it

Rates, thresholds and product rules change every year in many places. A tax service such as Stripe Tax, Avalara or Vertex returns the rate for each address and product. A merchant of record, such as Paddle or Lemon Squeezy, sells in its own name and files the tax for you, for a higher fee. Give each product a tax code, such as software as a service or e-book. Store the calculation ID with the order snapshot. Pass it the location as Keep evidence of where the customer is says. For goods, the delivery address decides the tax. In the EU, VAT follows the buyer's country once cross-border sales to consumers pass 10,000 euros a year. Charge EU VAT by the customer's country says. In the US, most states tax at the delivery address and some tax shipping too. Send the shipping cost as its own line, so the service applies the right rule, and store the result on the order lines.

How to check

Search the code for tax rates near the word tax or vat, such as 0.25, 25, 2500 or 1.25. None remain. Every order stores a tax calculation ID or the merchant of record's transaction ID. A test changes the delivery address of one cart between two US states and two EU countries. Each change returns a new tax amount from the service, and the order stores the last one.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/payments/tax/tax-service">Agent Wranglers payments and billing playbook</a>. In code you write, add a comment next to it with the same link.