stdnum.in_.gstin

GSTIN (Goods and Services Tax identification number, Indian VAT number).

The Goods and Services Tax identification number (GSTIN) is a 15 digit unique identifier assigned to all business entities in India registered under the Goods and Services Tax (GST) Act, 2017.

Each GSTIN begins with a 2 digit state code, the next 10 characters are the holder’s PAN, the 13th character is an alphanumeric digit that represents the number of GSTIN registrations made in a state or union territory for same the PAN, the 14th character is ‘Z’ and the last character is an alphanumeric check digit calculated using Luhn mod 36 algorithm.

More information:

>>> validate('27AAPFU0939F1ZV')
'27AAPFU0939F1ZV'
>>> validate('27AAPFU0939F1Z')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> validate('369296450896540')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> validate('27AAPFU0939F1AA')
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> validate('27AAPFU0939F1ZO')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> to_pan('27AAPFU0939F1ZV')
'AAPFU0939F'
>>> info('27AAPFU0939F1ZV')['state']
'Maharashtra'
stdnum.in_.gstin.compact(number)

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

stdnum.in_.gstin.info(number)

Provide information that can be decoded locally from GSTIN (without API).

stdnum.in_.gstin.is_valid(number)

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

stdnum.in_.gstin.to_pan(number)

Convert the number to a PAN.

stdnum.in_.gstin.validate(number)

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