stdnum.in_.pan

PAN (Permanent Account Number, Indian income tax identifier).

The Permanent Account Number (PAN) is a 10 digit alphanumeric identifier for Indian individuals, families and corporates for income tax purposes.

The number is built up of 5 characters, 4 numbers and 1 character. The fourth character indicates the type of holder of the number and the last character is computed by an undocumented checksum algorithm.

More information:

>>> validate('ACUPA7085R')
'ACUPA7085R'
>>> validate('234123412347')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> validate('ABMPA32111')  # check digit should be a letter
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> validate('ABMXA3211G')  # invalid type of holder
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> mask('AAPPV8261K')
'AAPPVXXXXK'
>>> info('AAPPV8261K')['card_holder_type']
'Individual'
stdnum.in_.pan.compact(number)

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

stdnum.in_.pan.info(number)

Provide information that can be decoded from the PAN.

stdnum.in_.pan.is_valid(number)

Check if the number provided is a valid PAN. This checks the length and formatting.

stdnum.in_.pan.mask(number)

Mask the PAN as per CBDT masking standard.

stdnum.in_.pan.validate(number)

Check if the number provided is a valid PAN. This checks the length and formatting.