.NET Client SDK for validating VAT numbers using the VIES vat number validation and accessing VAT information for all EU members.
$ dotnet add package demarbit.net.viesIntegrate the VIES Service API into your .NET project!
The Demarbit VIES .NET Library targets the .NET 8 framework.
To install the library via NuGet:
Demarbit.Net.Vies in the NuGet Library, orInstall-Package Demarbit.Net.Vies in the NuGet Package Manager, ordotnet add package Demarbit.Net.ViesTo validate VAT numbers you can use the ViesClient class:
var client = new ViesClient();
var vatResult = await client.ValidateVatNumberAsync(EUCountryCodes.BE, "someVatNumber");
if (vatResult.isValid) {
Console.WriteLine("Valid VAT number:");
Console.WriteLine(" - Company = " + vatResult.Name);
Console.WriteLine(" - Address = " + vatResult.Address);
} else {
Console.WriteLine("Invalid VAT number.");
}
With the VatClient you can retrieve specific VAT rate information for a country.
var client = new VatClient();
var rates = client.GetRatesForCountry("BE");