From first principles we should be able to form a generalist approach to solving sales tax. Should be an algorithm in the public domain as far as I'm concerned. : )Reasoning from first principles only works if you're Elon Musk and you don't actually have to go beyond a superficial understanding of the problem domain. Unfortunately, there is no "generalist approach" to sales tax or VAT. Every jurisdiction has different rules and rates. The U.S. has more than 3000 different sales tax jurisdictions, of which more than 1000 levy sales tax on digital goods and services even on out-of-state sellers.
And that doesn't take into account the dozens of different definitions of what is a "digital good." Here's a surprise for the unwary: in more than a dozen states, downloaded software is treated as a physical good.
I'd take a solution that got me 80% there.
In this case, the last 20% will take 99% of the time and effort. And then you'll have to make sure to do that work all over again next year, and every year, when the sales tax/VAT laws are updated.