#2356·faker

Add pan() and gstin() generators to en_IN provider

Author: RedZapdos123Created Apr 3, 2026Updated Sep 10, 2026

Details:

  • Faker version: 40.12.0.
  • OS: Windows / Linux / macOS.

Add pan() and gstin() generators to en_IN.

en_IN already includes aadhaar_id(), but PAN and GSTIN generators are missing.

PAN and GSTIN are common in India focused billing, invoicing, ERP, and compliance workflows, so adding these methods would reduce custom generator code in downstream projects.

Current behavior:

pan() and gstin() are not available in en_IN.

Expected behavior:

en_IN should provide:

  1. pan() that returns structurally valid PAN values.
  2. gstin() that returns structurally valid GSTIN values with valid checksum.
  3. Tests for format and checksum rules.
  4. Documentation examples for both methods.

Steps to produce:

python
from faker import Faker

fake = Faker("en_IN")

# Expected after this change:
fake.pan()
fake.gstin()

Proposed implementation:

  1. Extend faker.providers.ssn.en_IN.Provider.
  2. Add formatter methods: pan() and gstin().
  3. Keep implementation aligned with existing SSN provider conventions.
  4. Add tests in tests/providers/test_ssn.py (extend TestEnIn).

Format constraints:

PAN:

  1. Length: 10.
  2. Pattern: ^[A-Z]{5}[0-9]{4}[A-Z]$.

GSTIN:

  1. Length: 15.
  2. Pattern: ^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z][0-9A-Z]Z[0-9A-Z]$.
  3. Last character should be checksum from first 14 characters.

Test expectations:

  1. Repeated generation checks (for example 100 samples).
  2. Regex and length validation for both methods.
  3. Checksum verification for generated GSTIN values.
  4. Deterministic output under seeding.

I can work on this in a focused PR if the maintainers are aligned with this scope.