# 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:

- https://bajajfinserv.in/insights/what-is-goods-and-service-tax-identification-number

- https://ddvat.gov.in/docs/List%20of%20State%20Code.pdf

- https://en.wikipedia.org/wiki/Goods_and_Services_Tax_(India)

    >>> 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: str) → str

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

stdnum.in_.gstin.info(number: str) → dict[str, str | int | None]

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

stdnum.in_.gstin.is_valid(number: str) → bool

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

stdnum.in_.gstin.to_pan(number: str) → str

  Convert the number to a PAN.

stdnum.in_.gstin.validate(number: str) → str

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