Computing and verifying VAT in .NET (for EU businesses)
When you sell your software as an EU business, you need to take into account the VAT, which depends on whether you sell to a private individual or a company, and their country of residence. Moreover, you need to ensure that the VAT id that they have provided is correct.
In order to solve these two problems, we have published a library for .NET, available as a NuGet package (with source code on GitHub).
Examples
The library has two methods, CalculateVAT and IsValidVAT, which are quite simple to use. We explain their purpose below:
- CalculateVAT – This method asks for the country of residence of the individual or the company, and their VAT id (if applicable). Based on this information, it will calculate the necessary tax that should be applied to the order. Note, we assume you sell products or services that are covered by the standard VAT (i.e. some categories such as books have a lower tax in some countries).
- IsValidVAT – This method is responsible for VAT id verification. We use the European Commission’s API for that. Note, this API is not up 24/7 and can be unresponsive some times. You can view all the times it is down (given the country of residence) here.