Validating credit card checks
Additionally, by having access to the current card type, you can better manage the state of your credit card form as a whole.A Credit Card number must pass the Luhn Algorithm test to see if it is a valid credit card number.The Luhn mod N algorithm is an extension that supports non-numerical strings.
Credit Card Validator provides validation utilities for credit card data inputs.
It is designed as a Common JS module for use in Node.js, io.js, or the browser.
Credit Card Validator will also provide a determined card type (using credit-card-type).
This is useful for scenarios in which you wish to render an accompanying payment method icon (Visa, Master Card, etc.).
Therefore, systems that pad to a specific number of digits (by converting 1234 to 0001234 for instance) can perform Luhn validation before or after the padding and achieve the same result.
Prepending a 0 to odd-length numbers makes it possible to process the number from left to right rather than right to left, doubling the odd-place digits.
The algorithm appeared in a US Patent for a hand-held, mechanical device for computing the checksum. The device took the mod 10 sum by mechanical means.
The substitution digits, that is, the results of the double and reduce procedure, were not produced mechanically.
This self-checking scheme (referred to as the Luhn Mod-10 Method) is an international standard for validating card account numbers (ISO 2894/ANSI 4.13).
Such account numbers, which cannot exceed 19 digits including the check digit, are assigned, embossed and encoded to include a single check digit in the rightmost position.
The Luhn algorithm or Luhn formula, also known as the "modulus 10" or "mod 10" algorithm, is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers, IMEI numbers, National Provider Identifier numbers in the United States, Canadian Social Insurance Numbers, Israel ID Numbers and Greek Social Security Numbers (ΑΜΚΑ). 2,950,048, filed on January 6, 1954, and granted on August 23, 1960.