Check Digit Guide
Integration via Bills Payment CDV
How to make your own Check Digit Algorithm
What is Check Digit?
The check digit is a method of validation where a single digit is added onto the end of a code number by the computer. The check digit is calculated from the other digits in the number and are included in bar code numbers.
- When the number is printed, the computer calculates and adds a check digit to the end of it.
- When the number is inputted into the computer, a calculation is performed to check whether the check digit on the end of the number is valid. If not, then the number has been misread, thus should be re-entered.
Producing your own Check Digit
This procedure is used to generate a check digit to add to the end of a number. It uses the Modulo-11 weighted check digit calculation. This calculation is used for ISBN numbers on books.
Check Digit Algorithm may vary differently per Partner Biller. This section shows how most Billers have their algorithm through the Modulo-11 weighted check digit calculation.
- Start with the original product number e.g. 185813415.
- Weight each digit by its position in the string and add up the results. Note that the lowest weight used is 2:
Digit: | 1 | 8 | 5 | 8 | 1 | 3 | 4 | 1 | 5 | |
---|---|---|---|---|---|---|---|---|---|---|
Weighting: | *10 | *9 | *8 | *7 | *6 | *5 | *4 | *3 | *2 | TOTAL |
Result: | 10 | 72 | 40 | 56 | 6 | 15 | 16 | 3 | 10 | 228 |
- Divide the total by 11 and then subtract the remainder from 11. The check digit is the result of this operation:
- 228 / 11 = 20 remainder 8 =>
- If the remainder is 10, then the check digit is set to X. If it is 0, then the check digit is 0.
- As the remainder is neither 10 nor 0, the check digit is calculated like this:
- Check digit is 11-remainder = 11-8 = 3
- Add the check digit to the end of the original number to get the complete product number: 1858134143
Validating a Number Including a Check Digit
The procedure to check if a number with a check digit in it has been inputted correctly is similar to that used to generated the check digit.
- Input the number including the check digit. e.g. 1858134153
- Weight each digit by its position in the string and add up the results:
Digit: | 1 | 8 | 5 | 8 | 1 | 3 | 4 | 1 | 5 | 3 | |
---|---|---|---|---|---|---|---|---|---|---|---|
Weighting: | *10 | *9 | *8 | *7 | *6 | *5 | *4 | *3 | *2 | *1 | TOTAL |
Result: | 10 | 72 | 40 | 56 | 6 | 15 | 16 | 3 | 10 | 3 | 231 |
- If the last digit in the number is an X, then it is treated as the number 10.
- Divide the total by 11.
- 231 / 11 = 21 remainder 0
- If the reminder is 0 then the number has passed the validation check and so it is likely that it has been inputted correctly.
It is important that each digit is weighted before the numbers are added up. If this was not done then a check digit would not detect transposition errors (where two digits are swapped around). This is a particularly common form of error when numbers are typed.
Reference: Check Digit Validation and Verification
Excited to Integrate?
To understand the technical integration experience, head to our CDV Quick Start Guide.
Updated 9 months ago