
Show HN: A REST API for Calculating VAT in the EU - mherrmann
https://vatmossapi.com
======
Silhouette
The EU administration itself or the national tax authorities in the EU should
have provided an official service like this to go with the VAT changes for
digital sales from day one.

I appreciate someone else stepping up and doing it, though I'd want to see
more information about the source(s) they were using for the data and how
frequently they were checked before I'd hook a real business up to a third
party service like this.

~~~
jacquesm
They did, it's called the VATMOSS portal: [https://www.ros.ie/vatmoss-
web/vatmoss.html](https://www.ros.ie/vatmoss-web/vatmoss.html)

The problem is that it is a pain to use and too labor intensive to be
practical.

~~~
Silhouette
I'm painfully aware of the EU VAT MOSS system and how it "works"[1], but as
far as I can see, that doesn't explain the source for the near-real-time tax
rate data being offered here.

[1] Obviously it doesn't really work very well at all, and multiple national
tax authorities have already been caught sending unjustified threats to many
businesses for money they never owed, among other screw-ups.

~~~
jacquesm
This is just a lookup table. An actual service should go a lot further to be
useful. Note how it does not matter what country the seller is in so that
parameter can be ignored. What remains is a - hopefully always up-to-date -
lookup table that converts a country code to the highest VAT Rate.

That's hardly worth an API.

~~~
Silhouette
It's the "hopefully always up-to-date" that is my concern.

There are, at minimum, 28 different rates to monitor here. They can be changed
arbitrarily by their national governments, and in at least one case already
such a change has been made with just a week's notice.

Even if you're only checking those rates against your existing look-up table
manually, the effort to do so at least every week is going to add up.

There should have been an authoritative, machine-readable source for this data
from day one, and vendors should have been able to rely on that data and
protected from consequences if the authorities provided incorrect information
and vendors acted on the incorrect information in good faith.

------
kk_cz
How about different rates for different goods / services? This looks like a
gross oversimplification. Doing VAT correctly is quite hard - there is a
reason why there are dedicated VAT specialists working in larger consulting
firms.

~~~
mherrmann
It's only for digital goods/services.

~~~
kk_cz
Ok, sorry, now I see it :)

------
agopaul
The barrier of running an EU B2C business is so high if you need to sell all
over EU that most of the time it doesn't even make sense. It's a shame because
if you're in the EU and you want to bootstrap a small B2C business you have no
choice other than sticking to the country you're in.

~~~
tonyedgecombe
Or you just outsource it to someone like Avangate.

~~~
agopaul
I don't know how their service works. Do they pose as a 'gateway company'
between you and your customers or are they just a payment gateway? If it's the
latter, then the hardest problems still stand since accounting and invoicing
is still something that you have to do.

It would be great to have a service that resells your goods/services and takes
care of all that stuff so you can send a single invoice to them every month
and that's it, but frankly, I'm not sure of the legal part of that.

~~~
tonyedgecombe
They are buying the product from you and selling it on to the customer. So you
only have one customer to deal with and you just need to invoice them once a
month.

------
thirdsun
Is there any reason to ask for the country of the business/seller? As far as I
know it's irrelevant and the VAT only depends on the buyer's country (for
digital goods/services).

~~~
nik736
You need it for sure. Example:

I have my business in Germany. If I write an invoice to a german company I add
19% VAT. If I sell to a company inside the EU but not in Germany I add 0%,
since it's a reverse charge.

That means that the company in the EU country directly pays the taxes to their
country and I don't have to pay it to my country. This solves a lot of
bureaucracy hassle.

Exception is where I am selling to no business, but a private person within
the EU, I will charge VAT there and pay it to my country which redirects it to
the EU country (that's called MOSS).

~~~
thirdsun
I'm aware of that. However since the service in question only seems to handle
the business to consumer case, I don't see a need for asking for seller's
country.

------
ckastner
While the effort in general should be appreciated (especially open sourcing
the code!), I'm doubtful that the REST API has practical use.

"I calculated the VAT for the products I'm selling using that one website" is
just too much of a liability risk for a business to take. Who do you hold
liable in the event that the calculation was wrong?

~~~
mherrmann
The data for the API comes from the most widely used open source library on
the subject [1]. It has 418 stars, is used by lots of people and is
continually receiving pull requests / input from users. I bet you that it is
not easy to find another entity (be it a person, an organisation or a piece of
software) that knows as much about the problem.

Of course, you are right about liability. You can sue your accountant. But I
assume it will be more difficult for an open source project.

[1]: [https://github.com/mpociot/vat-
calculator](https://github.com/mpociot/vat-calculator)

~~~
ckastner
That's the problem: even with top-notch data, unless you continuously audit
the source code, you're still blindly trusting a third-party website regarding
tax advice. In the event that something goes wrong, that could be construed as
negligent.

Hence why I appreciate that yours and the other project are open source!
Because even though I might not be able to use the REST API, I can certainly
download the code and integrate locally after auditing it, or having it
audited by my accountant, or tax attorney, or whatever.

------
NicoJuicy
Something similar, but not the same:
[http://ec.europa.eu/taxation_customs/vies/technicalInformati...](http://ec.europa.eu/taxation_customs/vies/technicalInformation.html)

Official Europe VAT Verification Service endpoint ( docs )

Edit: for checking the VAT Id

~~~
mherrmann
You mean VAT _ID_ verification service. That's needed for when you're selling
to _businesses_ in the EU. Then, the VAT you have to charge is 0% and the
businesses have to pay it themselves when they buy from you.

------
talideon
That won't work in Ireland. While 23% is the headline rate, it's not the only
rate: [https://www.taxworld.ie/vat/summary/vat-
rates/](https://www.taxworld.ie/vat/summary/vat-rates/)

~~~
Silhouette
There are variable rates almost everywhere, but this API is specifically about
digital sales (where the MOSS system applies) so it will typically be that
headline rate that you need anyway.

Of course, there's no guarantee that that will always be the case, and to know
for sure you need to understand the tax systems of 28 different EU member
states. This is (one of many reasons) why the new EU VAT rules have been so
controversial: the burden for reliable, full compliance is ridiculous.

~~~
talideon
Sure, the headline rate is applicable for most things, but not everything, and
those differences can be important. For instance, if Amazon are selling
children's shoes into Ireland, they _must_ charge 0% VAT. That's still a
digital sale.

~~~
Silhouette
That's a sale of goods, though, which isn't currently covered by the VAT rules
and MOSS scheme that we're discussing here, and doesn't seem to be the
intended use for the OP's API.

~~~
talideon
That still makes it rather useless as an API, when it could be reduced down to
a conditional GET on a CSV file listing the countries and their headline VAT
rates.

For this to be useful as an API, it would need to deal with the actual
complicated bits of VATMOSS, which is dealing with multiple different rates
for different product types.

------
andy_ppp
I was looking into this recently and found this for Elixir, it looks good:
[https://github.com/xavier/european_vat](https://github.com/xavier/european_vat)

------
thiscatis2
You should specify a bit more clearly (it's on the bottom though) that this is
for B2C. B2B different rules apply.

------
vog
While this is a great way for you to collect internal business numbers from
other companies, I don't quite see how the benefit for those companies is so
large that it warrants sending internal information to you.

By the way, do you plan to provide statistical summaries of your findings?
Such as: How many companies from country X works with what set of countries Y?
How many invoices do they (approximately) file to which country?

EDIT: Fixed typo.

~~~
mherrmann
No bookkeeping numbers are being sent at all? Unless you count a pair of
countries and a post code (without any amounts or anything!!) as bookkeeping.

~~~
vog
Sorry, this was a typo. I meant business information, not bookkeeping
information.

 _> Unless you count a pair of countries and a post code_

It is more than that. You also have the source IP address, which you can map
not only to countries, but to relatively small regions and sometimes to
individual companies.

If this service was meant to be "datensparsam", it would provide an updated
table or dataset, and not require a single request for every small bit of
information.

~~~
mherrmann
Oh come on, how is that sensitive. Use a proxy if you're really worried about
this.

~~~
vog
Not really worried, more curious how the collected datasets will be analyzed.

~~~
mherrmann
Nothing, honestly. That data on its own has no value to me.

~~~
jacquesm
Then you should say so on the page or in a separate privacy statement.
Transparency about such details is very important in this space.

~~~
mherrmann
I'll add it, thanks. This was just a weekend project.

~~~
jacquesm
You may also want to drop fields that you don't actually use in the lookup.

------
anon2017100
In Greece, in some island in the Aegean Sea, the VAT rate stayed at 17% for
2017 (and did not rise to 24%).

------
jacquesm
This does not make the distinction between consumers and corporate (VAT
registered) customers nor does it make a distinction between services and
goods (and various classes of goods, to make things even more complicated).
Which makes me suspect this is a very broken implementation and you should not
rely on it for your business needs.

~~~
Silhouette
Given that it's specifically for VAT MOSS, presumably it's specifically
intended for B2C sales of digital products/services where the MOSS-related
place of supply rules apply?

~~~
jacquesm
Yes, but the customer isn't always a consumer, so in that case you get a lot
of extra burden: pull in the VAT number of the consumer, verify it and if it
is correct make the sale without VAT, otherwise make the sale with VAT.

If you don't do that properly you're either leaving money on the table or you
could be later charged with the difference. Note that under VATMOSS any of the
tax adminstrators in the EU has the right to audit you so it really pays off
to do this well.

And it's the 'place of consumption' rather than the 'place of supply'.

~~~
Silhouette
_Yes, but the customer isn 't always a consumer, so in that case you get a lot
of extra burden: pull in the VAT number of the consumer, verify it and if it
is correct make the sale without VAT, otherwise make the sale with VAT._

Yes, but such sales are outside the scope of the VAT MOSS scheme.

 _Note that under VATMOSS any of the tax adminstrators in the EU has the right
to audit you so it really pays off to do this well._

We're well aware of this. We spent a great deal of time trying to implement a
fully compliant system when the new rules came into effect, and we were still
among the first businesses to get one of the fake demands for money never owed
because apparently with our vast resources as a little family business we were
better at getting it right than several national tax authorities with the
resources of an entire government behind them. If that isn't a perfect
illustration of the impracticality and excessive burden of the current system,
I don't know what is.

 _And it 's the 'place of consumption' rather than the 'place of supply'._

No, for digital services and private consumers, it's the place of supply rules
that changed:

[https://www.gov.uk/government/publications/vat-supplying-
dig...](https://www.gov.uk/government/publications/vat-supplying-digital-
services-to-private-consumers/vat-businesses-supplying-digital-services-to-
private-consumers)

Of course the practical effect of the changes is typically that the place of
supply is now treated as the customer's location where previously it was
probably the business's location, so perhaps that's what you meant and we're
really talking about the same thing here.

~~~
jacquesm
> Yes, but such sales are outside the scope of the VAT MOSS scheme.

So why ask for the country of the seller in the API?

> Of course the practical effect of the changes is typically that the place of
> supply is now treated as the customer's location where previously it was
> probably the business's location, so perhaps that's what you meant and we're
> really talking about the same thing here.

Yes, that's what I meant.

BTW that 'demand for money' also happened to me, it appears that in the first
few months of VATMOSS there was a massive cock-up at the Irish department
tasked with this leading to a whole pile of nastygrams sent to lots of EU
businesses, they never even apologized for that (or sent any follow up saying
that they were in error).

~~~
Silhouette
_So why ask for the country of the seller in the API?_

I wondered the same thing. I'm not aware of any circumstances under which it
would make a difference that are still affected by MOSS.

 _BTW that 'demand for money' also happened to me_

My sympathies. The Irish department reportedly wasn't the only one to mess up
like this, either, though it's the only one I've encountered personally so
far. In the UK, it was actually HMRC (our own national tax authority) that
sent out messages to affected businesses confirming it was an error.

~~~
mherrmann
> So why ask for the country of the seller in the API?

I must admit I'm not 100% sure either. I'm just exposing the API of the
underlying open source project which says to supply the seller's country [1].

[1]: [https://github.com/mpociot/vat-
calculator](https://github.com/mpociot/vat-calculator) At the bottom, where it
says "Important"

~~~
jacquesm
If you're 'not sure' you should take this offline until you _are_ sure.
Bookkeeping is an extremely bad area to go 'move fast and break stuff' because
what you're breaking is other people's administrations and you won't have a
way to fix it or even to reach them to inform them of an issue.

~~~
mherrmann
You're being extremely critical in this entire thread. Tell me: How is having
this field, unnecessary or not, a risk? You want me to take the site offline.
But it's providing value to my own business, and apparently other people find
it interesting as well. It's merely a REST API for an existing open source
project. And whether people use the library or the REST API is the same from a
risk perspective from their point of view. I'm providing value here, and am
happy to run the risk you're advising against. So I will not take it offline.

~~~
jacquesm
> You're being extremely critical in this entire thread.

Yes.

> Tell me: How is having this field, unnecessary or not, a risk?

\- an unnecessary field implies that that field is either being collected or
being used in the calculations, if it isn't then it simply should not be
there.

> But it's providing value to my own business, and apparently other people
> find it interesting as well.

I'm sure it is, but it is _also_ a risk and it seems as though you have not
done the homework required to field a service such as this. That's a dangerous
hobby.

> It's merely a REST API for an existing open source project.

No, it is a piece of software that you field that has the risk of affecting
businesses that use it in a critical and potentially negative way if you mess
up and it does not appear that you treat this subject with the seriousness
normally associated with such a project.

> And whether people use the library or the REST API is the same from a risk
> perspective from their point of view.

That is so far from the truth that I again wonder if you know what you are
doing.

> I'm providing value here, and am happy to run the risk you're advising
> against. > So I will not take it offline.

Suit yourself.

------
mike-cardwell
This shouldn't be an API. It should be a query library and a dataset you can
download with a batch job.

Please consider releasing the source code.

~~~
mherrmann
All it does is provide a REST API for an existing open source library. That's
written on the home page.

You can use the existing open source library (if you're using PHP). But then
you have to keep it updated. The API does that for you - as well as allowing
you to use it from any language.

------
tomschlick
VAT just sounds like a huge, overcomplicated mistake by the EU.

Why do you guys continue to live with it instead of repealing or fixing it?

~~~
bambax
"VAT" (the idea) is certainly not a mistake, it's one of the best way to do
taxes, because it's, if not painless, at least almost invisible to the
taxpayer (but it's considered by many to be unjust, because the poor spend a
much larger part of their income in taxable goods than the rich, and so pay a
bigger share of VAT).

The complexity of VAT in Europe is recent.

(I think) it used to be the case that if you sold something from one European
country to another, then you weren't subject to VAT because it was considered
an "export". Foreign companies (esp. US-based ones like Amazon) exploited this
loophole so much, it became a problem. All they had to do was set up shop in a
small, low-tax country [1] (Luxembourg / Ireland) and sell in every other
country tax-free.

So the EU created this rule that the VAT that should be paid, is the VAT of
the country where the customer resides -- it had to be, because if it was the
VAT of the seller's country then companies would have again clustered in the
country with the lowest VAT in order to evade the new rule.

It's not a bad rule; if you're a huge corporation, well, maybe you don't like
it but you can hire the necessary lawyers and accountants to implement it.

If you're an SMB that sells across Europe, it's absolutely horrible. I guess
the bureaucrats who wrote the rule didn't care much about SMBs or thought
there were few who sold internationally.

It would be simple to exonerate SMBs based on their revenue (and I think it's
the case, but the triggers are very low and different in every country); it
would be even simpler to have just one tax rate but that's politically
impossible.

In practice it doesn't seem to be very much enforced for small companies.

\- - -

[1] Low _corporate_ tax, to optimize taxes even further; no need to be based
in a low-tax country to free oneself from VAT; the smaller the country the
better, because you want to have as few of your customers in the same country
as you, as possible.

~~~
waynecochran
I am admittedly naive on these matters, but I always thought that VAT is more
efficient than a sales tax from the vendor's perspective and transparent to
the consumer (an item costs $1.25 and you pay $1.25).

~~~
kspaans
The main difference between VAT and sales tax is that VAT is paid by each
stage in the supply chain (every time someone "adds value"), and reclaimed by
charging it to the next stage up in the chain. Sales tax is charged only once,
at the final point of sale to the consumer.

The end effect is the same: the consumer ends up paying whatever % the tax is.
The difference is in how it's collected. Sales tax is easier to evade because
business-to-business sales usually don't charge sales tax. So you could wink
at your customer and say they're a business and not charge them sales tax.
With VAT everyone is supposed to pay it, so it's harder to evade (and
consequently more expensive for governments to collect).

~~~
martinald
But on the other hand there is a catastrophic amount of VAT carousel fraud
going on, which is even worse than just 'tax fraud' (ie: not paying tax)
because the govt is paying out VAT losses but not then collecting the VAT
gains in the carousel.

------
sajal83
Why use POST?

~~~
mherrmann
It made the curl example easier to write.

------
timvdalen
Doesn't seem correct, at least for Holland.

As far as I'm aware, as a seller in The Netherlands, you only have to charge
VAT for buyers that are also in The Netherlands.

~~~
wayn3
VAT is technically paid by the customer, you just collect them to make the
process slightly less ridiculous.

therefore, VAT is paid based on customer location.

this does not mean that you dont have to pay VAT at all if you sell to
germany. in that case, you ahve to pay german VAT. if youre smalltime enough,
its likely that nobody will go after you, but thats what it is.

~~~
timvdalen
Correct, but you're not required to pay the local (Dutch) VAT, so the seller
doesn't have to collect it. This tool shows the Dutch VAT rate (0.21) for all
buyer countries, which is not correct in that case.

~~~
mherrmann
I think you're wrong. Just because you don't owe VAT to the Netherlands
doesn't mean you don't owe it to another EU country.

[edit] Maybe I misunderstood. In what situation do you think you don't have to
pay Dutch VAT, and what's the source of your information?

~~~
timvdalen
[https://www.belastingdienst.nl/wps/wcm/connect/bldcontentnl/...](https://www.belastingdienst.nl/wps/wcm/connect/bldcontentnl/belastingdienst/zakelijk/btw/zakendoen_met_het_buitenland/goederen_en_diensten_naar_andere_eu_landen/goederen_en_diensten_naar_andere_eu_landen)

>Over het algemeen brengt u geen btw in rekening aan ondernemers uit andere
EU-landen. Bij goederen past u dan het 0%-tarief toe en bij diensten wordt de
btw naar uw klant verlegd.

In general, you should not charge VAT to entrepreneurs from other EU-
countries. For goods, the 0%-tariff applies. For services, the VAT is
transferred to the client. (Which means they need to declare the transaction
and pay VAT in their country, which has nothing to do with your transaction
with them).

~~~
jacquesm
Goods and services are dealt with completely differently when targeted at
consumers or corporate customers (depending on the country). So there are 4
different combinations times the number of EU countries. And there are more
exceptions when it comes to goods depending on the class of goods (food for
instance).

