Auto detect credit card type vs ask the user
Is it better to ask the user what type of credit card is being entered or to attempt to auto-detect card type using regular expressions?
Some online merchants ask for the credit card type explicitly (Visa, Mastercard, Amex, etc) in a drop-down menu. While others, including Amazon and GitHub, never ask explicitly and instead rely on the properties of the card to determine the card number.
One problem with relying on card type auto-detection is credit card regular expression patterns seem to need updating over time. So these regular expression patterns may need constant updating to remain accurate and prevent holes in the patterns.
Which is better, asking the user for card type explicitly or attempting to auto-detect card type? Are there other considerations?
I've done this kinda sfwr for 20 years and I still sometimes make the mistake of mis-marking my card when I place an order online. Then I get the error that the number I gave is not a VISA card. Silly, when it's so trivial for the programmer to attend to this and never show such an error to the shopper.
Paypal is the only major gateway that wants you to submit the card type with the transaction (I've never tested to see if they will return an error if you get it wrong). The shopper may get the card wrong as I sometimes do, but a regexp never will. If you are writing for any major gateway but Paypal anyway, you either won't be asked or the answer you furnish will be ignored.
Make the checkout process easiest on your shopper and your merchant happy with a speedier checkout. It's not going to have a material effect on the transaction.
Look closely at your gateway API - I'll bet they are not even asking - they can tell by looking at the card number.
One of the reasons they may ask for the credit card type is to provide with multi-part text input.
XXX - XXXX - XXXX - XXXX
for American Express XXXX - XXXX - XXXX - XXX
for Enroute XXXX - XXXX - XXXX - XXXX
for Others One may argue, it's more usable this way since the user gets a visual representation that matches the card. Also, it may be for hinting where to find the CSC (tho, that can also be inferred from the number).
链接地址: http://www.djcxy.com/p/70730.html上一篇: 信用卡类型和验证
下一篇: 自动检测信用卡类型与询问用户