4 Jul 2008

EU-based businesses are required to obtain valid VAT numbers from VAT-registered entities.

Unfortunately, especially for e-commerce systems, there isn't a simple way to check the validity of a European VAT number. The European Commission provides a web site where you can validate VAT numbers by entering them in an HTML form. This is not practical, of course, for web applications.

Enter, the European VAT Number Validation API that I just hacked together on Google App Engine.

You can hit a URL like http://isvat.appspot.com/GB/802311782/ and get a true or a false back as a simple JSON boolean.

Check out the European VAT Number Validation API.

I hope you find it useful.

Creative Commons LicenseThe European VAT Number Validation API article by Aral Balkan, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial 2.0 UK: England License.

Add Your Comment

Spam Protection by WP-SpamFree

European VAT Number Validation API

  1. oh that’s very useful, thanks Aral!

    Peter
  2. You shuld make it return application/json replies instead of text/html. See:

    $ curl -i http://isvat.appspot.com/GB/802311782/
    HTTP/1.1 200 OK
    Content-Type: text/html; charset=utf-8
    Date: Fri, 04 Jul 2008 12:19:03 GMT
    Server: Google Frontend
    Content-Length: 4

    true

    Erki Esken
  3. Hi Erki,

    It’s on purpose. I want people to be able to test out the API in the browser — even non-techies. I don’t think my accountant (whom I just sent the link to) would understand what to do with a JSON file download when she hits the site but she’ll still be able to use it in the browser at the moment manually.

    When I get some time, I’ll add a separate JSON endpoint — this was something I threw together before breakfast this morning :).

    Aral
  4. Hey Erki,

    OK, I just added JSONP support (pass ?callback=nameOfCallback) and I’m now returning application/javascript so that it currently fits my use-case too.

    Aral
  5. Nice API Aral.
    I was looking for something like this a couple of years back.

    Farid Abdulhadi
  6. Hello Aral,

    You probably know this as it’s mentioned in the FAQ, but there is in fact an official SOAP web service provided by VIES (WSDL here: http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl). We are using it on one of our web applications to allow online registration of companies. I don’t know if your own service is relying on it, or simply parsing the output of the “human-oriented” website.

    I personally agree that your solution, being REST-based, is more elegant, but people might prefer SOAP or feel more comfortable using an “official” service.

    In either case, I’m still trying to find a solution which allows applications to keep functioning even when the VIES site/service is down (which seems to be the case for the moment, at least for certain VAT numbers). One solution is to simply rely on syntax validation (check for example http://www.braemoor.co.uk/software/vat.shtml for a JS-based solution).

    Nicolas Jacobeus
  7. Hi, and thanks for you code.

    As Nicolas said there is an official wsdl… Some php code to use it :

    $client = new SoapClient(null, array(’location’ => “http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl”,’uri’ => “http://test-uri/”));
    $params = array(”countryCode” =>”FR”,”vatNumber”=>”00000000000″);
    $result=$client->__soapCall(”checkVat”, $params);
    var_dump($result);

    MoksA
  8. Hi,

    Thank you MoksA for your example, it seems to works good.

    But what is the ‘uri’ parameter in your soap declaration ?

    zmove
  9. I can’t believe that the EU didn’t think of doing this. First, the taxes, and then, hard-to-get-to information on the taxes :-)

    Thanks for this!
    R

    Richard
  10. Nice they have a webapi for it, but it seems down now :-(

    Gerwin