stdnum.se.vat

VAT (Moms, Mervärdesskatt, Swedish VAT number).

The Momsregistreringsnummer is used for VAT (Moms, Mervärdesskatt) purposes and consists of 12 digits of which the last two should be 01. The first 10 digits should have a valid Luhn checksum.

>>> validate('SE 123456789701')
'123456789701'
>>> validate('123456789101')  # invalid check digits
Traceback (most recent call last):
    ...
InvalidChecksum: ...
stdnum.se.vat.compact(number)

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

stdnum.se.vat.is_valid(number)

Check if the number is a valid VAT number.

stdnum.se.vat.validate(number)

Check if the number is a valid VAT number. This checks the length, formatting and check digit.