Home > Uncategorized > Using the official #VIES API in c# for #VAT lookups

Using the official #VIES API in c# for #VAT lookups


Sometimes it surprises me how some companies repackage a free, official API, and then charge for it, VATAPI.com is a good example of this, the official VIES EU VAT commission offers a free webservice available here:


And you can use it from C# with some code as follows,

var vat = new vat.checkVatPortTypeClient();
bool blnValid;
string strName;
string strAddress;
vat.checkVat(ref strCountryCode, ref strVatNumber, out blnValid, out strName, out strAddress);

That’s what’s behind my VAT checker app for iOS:

Categories: Uncategorized
  1. Owin
    May 13, 2016 at 12:26 pm

    Hi, nice post!

    I copied your code, but I get an error invalid_input on the checkvat() method. Am I missing some configuration?


  2. Vijay
    November 5, 2018 at 12:54 pm


    Here is the code for vatCheck in c#

    public class EuropeanVatInformation
    private EuropeanVatInformation() { }

    public string CountryCode { get; private set; }
    public string VatNumber { get; private set; }
    public string Address { get; private set; }
    public string Name { get; private set; }
    public static EuropeanVatInformation Get(string countryCode, string vatNumber)
    if (countryCode == null)
    throw new ArgumentNullException(nameof(countryCode));
    if (vatNumber == null)
    throw new ArgumentNullException(nameof(vatNumber));

    string _countryCode = countryCode;
    string _vatNumber = vatNumber;
    string _address = “”;
    string _name = “”;
    bool _valid = false;
    ServiceReference2.checkVatPortTypeClient client = new ServiceReference2.checkVatPortTypeClient();
    string ReqDate = client.checkVat(ref _countryCode, ref _vatNumber, out _valid, out _name, out _address);
    if (_valid)
    var info = new EuropeanVatInformation();
    info.CountryCode = _countryCode;
    info.VatNumber = _vatNumber;
    info.Name = _name;
    info.Address = _address;
    return info;
    return null;


  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: