Validating Credit Card Numbers
Somewhat surprisingly, the method of checking if a credit card number is valid is public. Using a complicated method of cruising through the card's digits, you can create what's called a Luhn checksum. Once you've created this checksum, you can see whether it has a valid value. If the value isn't valid, then the card is definitely fake. If the Luhn checksum is correct, then the card might be valid. Since this method is public, it is possible to create your very own phony credit card numbers. However, this is super duper illegal, so for Pete's sake, don't do it. And besides, these phony numbers won't have valid names or expiration dates, so even if you decided on a life of crime, you'd need to do a lot of extra work ...
Get Advanced JavaScript™: Insights and Innovative Techniques now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.