3 ms·
I worked for a gift card company and wrote and maintained some client side card validation code. My suggestion for client side card validation is "don't do it".
by asimeqi 14y ago
I worked for a gift card company and wrote and maintained some client side card validation code. My suggestion for client side card validation is "don't do it". As your client gets used more and more you will see a wild variety of cards. The minimum card length I have seen is 5. The maximum is 22. Some cards have correct checksum and some don't have checksum at all. Some cards have only numbers and some cards have letters and numbers. At the end we stripped all our fancy validation code and left only a check that card length was 3 or more.
All card validation must be server side.
- ceejayoz 14y agoGift cards aren't credit cards. The docs say "a general purpose library for building credit card forms", not "a general purpose library for building payment forms".
- jfoster 14y agoHow does it become easier to do such validation server-side?
- cj 14y agoYou can attempt to process it through your payment gateway (ie. stripe) and check for a success or failure.
- jimktrains2 14y agoThat becomes expensive. The more you can do on your own, the less in fee's you'll accumulate.