- 1
Check the starting digit of the credit card number. All potentially valid Visa cards begin with the number 4. All Mastercard numbers begin with numbers 51 through 55. American Express cards begin with either a 34 or a 37.
- 2
Verify the number of digits. While the old Visa cards had 13 digits, the new ones have 16. All Mastercard numbers have 16 digits and American Express credit card numbers are comprised of 15.
- 3
Perform a Luhn check. If there are an even number of digits on the card (like the new Visa or any Mastercard), you will be adding the digits and doubling every other one, beginning with the first digit. If it's an odd number of digits (like the old Visa or any American Express), you will add all of the digits, doubling every other one, beginning with the second digit. For example, if the first four digits are 5321 (a Mastercard), you would add all the digits, doubling the 5 (making it a 10) and the 2 (making it a 4), and so on. If the doubling results in a two digit number (10) add them together (1+0) and keep adding it to the total. In the end, if the resulting number is divisible by 10, you have a potentially valid account number.
5/3/11
How to Check for a Valid Credit Card Number
If your business takes credit cards, there may be instances when you want to check whether a customer has given you a valid credit card number. In most cases, a quick swipe through a credit card transaction machine as provided by your bank will do the trick. If this isn't feasible, then there are ways to manually check the validity of a credit card number.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment