June 2003
Intermediate to advanced
800 pages
34h 20m
English
You want to verify that a supplied credit card number is valid.
Manually compute and verify the checksum using Luhn’s algorithm, which all credit card numbers must satisfy.
Luhn’s algorithm is a formula that combines the digits of a credit card (doubling alternate digits) and verifies that the final sum is divisible by 10. If it is, the credit card number is valid and could be used for an account.
Here’s a helper function that you can use to test Luhn’s algorithm:
Private Function ValidateLuhn(ByVal value As String) As Boolean Dim CheckSum As Integer = 0 Dim DoubleFlag As Boolean = (value.Length Mod 2 = 0) Dim Digit As Char Dim DigitValue As Integer For Each Digit In value DigitValue ...
Read now
Unlock full access