Skip to main content

Validation guidelines

This guide covers:

  • SA ID Numbers
  • Entity Numbers
  • Passport Numbers

Validate SA ID Number Guidelines:​

Ensure the ID number is in the Correct Format​

• Length: The ID must be exactly 13 digits • Numeric Check: Ensure it contains only numbers (no letters or special characters)

Extract and Validate Birth Date:​

YYMMDD SSSS C A Z​

• YYMMDD: The first six digits represents the birth date • A sequence number (random, but males have 0000-4999 and females 5000-9999) • C: Citizenship (0 = SA Citizens, 1 = Permanent Resident • Z: A checksum digit (validate using the Luhn Algorithm)

Steps to Validate the Birth Date:​

• Extract YYMMDD form the ID • If YY is 00-99, assume 1900s or 2000s

Determine the Century:​

• Check if "20YY is less than or equal to the current year • If "20YY" is greater than the current year, assume "19YY" • Use a date function to validate the extracted birth date

Validate the Citizenship Digit:​

• 0 = South African Citizen • 1 = Permanent Resident • Anything else = Invalid

Apply the Luhn Algorithm for Checksum Validation:​

• Double every Second digit from the right – See Example below: • If the doubled value is greater than 9, subtract 9 • Sum all the digits • If the total is a multiple of 10 the ID is valid.

Combine All Checks​

• Validate length and numeric format • Validate Birth date • Validate Citizenship • Validate Luhn Checksum


Luhn Algorithm​

Identify Digits:

TEST ID (VALID): 7905105190089

Each digit is numbered from left to right:

LEFT TO RIGHT13121110987654321
DIGIT7905105190089

Double every second digit from the right

LEFT TO RIGHT13121110987654321
DIGIT7905105190089
DOUBLE181002016

If doubled digit is greater than 9 extract 9

LEFT TO RIGHT13121110987654321
DIGIT7905105190089
DOUBLE181002016
EXTRACT910207

Add up all the digits​

Non double digits (Positions 1,3,5,7,9,11,13)

LEFT TO RIGHT13121110987654321
DIGIT7015909

TOTAL 31​

Modified Doubled Digits (Positions 2,4,6,8,10,12

LEFT TO RIGHT13121110987654321
EXTRACT910207

TOTAL:19​

SUM the Total of Non double digits and Total of Modified digits

$$ 31+19=50 $$

If the sum is a multiple of 10, the ID number is valid

In this case the total is 50 therefore this is a VALID ID

TEST ID (INVALID): 9202204720085

Each digit is numbered from left to right:


LEFT TO RIGHT13121110987654321
DIGIT9202204720085

Double every second digit from the right

LEFT TO RIGHT13121110987654321
DIGIT9202204720085
DOUBLE44014016

If doubled digit is greater than 9 extract 9

LEFT TO RIGHT13121110987654321
DIGIT9202204720085
DOUBLE44014016
EXTRACT440507

Add up all the digits​

Non double digits (Positions 1,3,5,7,9,11,13)

LEFT TO RIGHT13121110987654321
DIGIT9024205

TOTAL 22​

Modified Doubled Digits (Positions 2,4,6,8,10,12

LEFT TO RIGHT13121110987654321
EXTRACT440507

TOTAL:20​

SUM the Total of Non double digits and Total of Modified digits

$$ 22+22=42 $$

If the sum is a multiple of 10, the ID number is valid

In this case the total is 42 therefore this is an INVALID ID


Validate SA BUSINESS registration number guidelines:​

Business Registration number format:​

YYYY/NNNNNN/XX​

  • YYYY - Year of Registration

  • NNNNNN = Unique sequential number

  • XX - Business type Identifier

  • Validation steps:

STEPS:​

  • Correct format: YYYY/NNNNNN/XX

  • Valid Year (YYYY): must be 4 digits

  • Unique Number: (NNNNNN) Must be a 6 digit number

  • Entity Type (XX):

CodeEntity Type
07Private Company (Pty Ltd)
06Public Company (Ltd)
08Non-Profit Company (NPC)
23Close Corporation (CC)
21Incorporated (Professional)
30State-Owned Companies
10External Companies
26Cooperatives

Note:​

  • There is no way to validate the format of the sequence number as an algorithm is not used in this case.

  • The format YYYY/NNNNNN/XX is for pre-account verification validation. Upon submission for Account Verification the / must be removed.


Validate a passport:​

Validating a passport number depends on the specific passport issuing country since each country has its own unique format for passport numbers. There isn't a universal validation system for all passport numbers, but some general guidelines can help determine validity or at least confirm proper formatting. Here's how you can approach validating a passport number:

General Guidelines for Passport Number Validation​

Length and Format:​

• Most passport numbers are between 6 and 9 characters long. • They often consist of a combination of letters (usually one or two) followed by numbers. • Some countries use serial number formats with a combination of letters at the beginning or end.

Country-Specific Formats:​

Each country has its own rules for passport number formats:

• United States: A typical U.S. passport number contains 9 characters: a mix of letters and digits. • United Kingdom: Typically contains 9 characters: 1 letter, 7 digits, and 1 letter. • South Africa: South African passports contain 8 characters, usually in the format: A1234567. • Canada: Typically has 9 characters: 1 letter followed by 8 digits. • India: The Indian passport number has 8 characters, beginning with the letter "A" followed by 7 digits.

Check Digits / Luhn Algorithm:​

Some countries, especially when using machine-readable passports (MRPs), may include a check digit or apply a checksum algorithm like the Luhn algorithm (common for credit cards and other identification numbers). This checksum ensures that the number is valid based on the structure and mathematical relationship between the digits.

Country Codes and Special Characters:​

Certain passport numbers may begin with a country code, indicating the country of issue.

Machine-readable passports (MRPs) include additional information encoded using OCR-B font, typically in the form of MRZ (Machine-Readable Zone) at the bottom.

Steps to Check the Validity of a Passport Number:​

• Check the length and structure: Ensure that the passport number follows the expected length and alphanumeric pattern for the issuing country. • Use regular expressions to match the pattern for a specific country's passport format. You can do this by writing a pattern for the expected passport format and checking if the number fits. • Checksum/validation algorithms: For countries that use machine-readable passports, you may need to apply algorithms like Luhn's Algorithm (if applicable) or other country-specific methods to check validity. • Consult the Issuing Authority: To definitively verify the authenticity of a passport, you would need access to the country's passport database or validation systems, which are not publicly accessible for privacy and security reasons.