stdnum.eu.vat

VAT (European Union VAT number).

The European Union VAT number consists of a 2 letter country code (ISO 3166-1, except Greece which uses EL) followed by a number that is allocated per country.

The exact format of the numbers varies per country and a country-specific check is performed on the number using the VAT module that is relevant for that country.

>>> compact('ATU 57194903')
'ATU57194903'
>>> validate('BE697449992')
'BE0697449992'
>>> validate('FR 61 954 506 077')
'FR61954506077'
>>> guess_country('00449544B01')
['nl']
stdnum.eu.vat.check_vies(number)

Queries the online European Commission VAT Information Exchange System (VIES) for validity of the provided number. Note that the service has usage limitations (see the VIES website for details). This returns a dict-like object.

stdnum.eu.vat.compact(number)

Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.eu.vat.country_codes = set(['gr', 'ee', 'it', 'cz', 'cy', 'at', 'ie', 'es', 'nl', 'pt', 'lv', 'lt', 'lu', 'ro', 'pl', 'be', 'fr', 'bg', 'dk', 'hr', 'de', 'hu', 'fi', 'sk', 'mt', 'si', 'se', 'gb'])

The collection of country codes that are queried. Greece is listed with a country code of gr while for VAT purposes el is used instead.

stdnum.eu.vat.guess_country(number)

Guess the country code based on the provided number. This checks the provided number against each of the validation routines and returns the list of countries for which it is valid. This returns lower case codes and returns gr (not el) for Greece.

stdnum.eu.vat.is_valid(number)

Checks to see if the number provided is a valid VAT number. This performs the country-specific check for the number.

stdnum.eu.vat.validate(number)

Checks to see if the number provided is a valid VAT number. This performs the country-specific check for the number.

stdnum.eu.vat.vies_wsdl = 'http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl'

The WSDL URL of the VAT Information Exchange System (VIES).

Previous topic

stdnum.eu.at_02

Next topic

stdnum.fi.alv