Hacker News new | ask | show | jobs
by amolgupta 3985 days ago
Use Luhn's algorithm to validate the card number on client side ranther than throwing an error from server. https://en.wikipedia.org/wiki/Luhn_algorithm
1 comments

Which is exactly what it does. Try entering a random 16 digit numer - it will probably be invalid, but then edit the last digit until it is accepted.

But, once you have a valid number, that's all it is, a number. So you still have to round-trip to the payment processor, via the server, to check the number represents an actual payment card, and has money available.