VAT Information Exchange System (VIES)

What is the VIES ?
It is an electronic means of transmitting information relating to VAT-registration (= validity of VAT-numbers) of companies registered in EU. Furthermore, information relating to (tax exempt) intra-Community supplies between Member States’ administrations is also transmitted via VIES

The Taxation and Custom Union has provided us developers a nice little webservice to use for validating VAT numbers realtime.

This is their public facing page for one off manual validation
http://ec.europa.eu/taxation_customs/vies/
The service to be used by your application can be found here
http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl

The FAQ is here http://ec.europa.eu/taxation_customs/vies/faqvies.do

Ok so now i will demonstrate how to use this in your Visual Studio based application

If you have Visual Studio 2010, and your building a web app, in solution explorer right click the web app root node and you should see “Add Web Reference”, this will present you with the “Add Web Reference” dialog box
Paste the above web reference link into the “URL” and hit the “GO” green arrow

VIES Visual Studio Web Reference

Now Hit “Add Reference” and Visual Studio creates the Web Server Proxy and Wrapper Class.
Ok so now your project has the reference lets see how to use it

On your page that you wish to validate a vat number you should do the following
1. Collect a valid 2 character country code from the User
2. Collect a valid vat number from the User
3. Perform the needed filter on both of these values prior to envoking the webservice
4. Verify the return from the service and take action

First off you will need to import the reference into your page. For ease I use asp.net vb, C# will be similar and there are plenty of converters out there to see the code in c#

now your ready to use the reference
For this example we will be supplying country code and VAT number only. There are various other methods available but this suited me so its the only demo you will be getting.
The rules
1.The country code must be valid
2. The VAT number must contain no spaces and only be numerical numbers
3. We pass the validation boolean as a byref, if you also wanted to see what the company name and address the EU have on file for the company the webservice verified, you can pass two strings “Name” and “address” byref and view the content upon return.

This is how i do it

Most of the above code is preparation, there are very few ines tha perform the webservice method.
The actual call is made in the try catch

My particular app verifies the value of IsValid in the calling function, how you validate the values is up to you, on asuccessful return the value will be true and the byref Name and Add will contain the registered company name and address.

For your reference there is also another way to reference the web service described here http://softwareobjects.net/technology/other/vies-vat-number-checker/