Live data from Hacker News

How to Correctly Detect Credit Card Type

creditcardjs.com

41–50 of 67 posts

Re: How to Correctly Detect Credit Card Type

#41

Please don't rely on this. For example of the extra detail that is really involved, see: http://en.wikipedia.org/wiki/List_of_Issuer_Identification_N... - e.g. 504837 is ATM only despite looking like a MasterCard. Card identification also occasionally changes - Diners was bought by MasterCard, Visa used to be 13 digits, etc. I'd be really wary of hard-coding this anywhere. If it passes the Luhn algorithm and the firs…

> Diners was bought by MasterCard

MasterCard didn't acquire Diners, it was just a partnership where Diners cards were branded as MasterCard and processed through MasterCard's network. Later Discover acquired Diners, and now they're processed through Discover's network.

But fair point - brand prefixes occasionally change, and if you hardcode them they'll eventually become out of date.

Re: How to Correctly Detect Credit Card Type

#42

Why does it even matter if you show the credit card type when the user is typing it in? If the first 6 numbers determine the card type, then handling card type can be done on the backend. Why make the effort to show users information that they already know, ie. card type?

Importance on the front-end isn't that high. Though we use it to change messaging around where the CVV is located. You do need to detect it on the backend as you have to pass it to the payment gateway, i assume the reason is to determine which network to put the transaction on. Some gateways take care of this step for you but most of older or lower level ones don't.

Re: How to Correctly Detect Credit Card Type

#43
post #37

Earlier quoted context omitted.

I can type right into a drop down, and 99 times out of 100 it will do the right thing. (Sometimes it's weird with a list of states, where it might be sorted by the state abbreviation while showing the state name or vice versa.)

agreed but on mobile I find spinning through the drop-down more annoying than typing the exp date.

I really hate the spinner for all the date selectors on iOS - it's cute, but a keypad is way faster.

Re: How to Correctly Detect Credit Card Type

#44
post #28

Why is detecting credit cards even useful? I know what card I have, you telling me "Yep that's a VISA card" isn't really that helpful. Yes, I might enter the first four digits wrong and see the wrong card icon light up may help me a little, but aren't I just as likely to enter the last 12 digits wrong. In the case of VISA you're pretty much just telling me "Yep, that first one is a 4".

Wouldn't it save the user one click to select what card they've got?

There's no need for the user to select it. Just collect the numbers and send it off to your payment gateway. If the card type is unsupported, which would be rare for anyone using a standard gateway that supports all major cards, then display an error message.

Re: How to Correctly Detect Credit Card Type

#45
post #28

Earlier quoted context omitted.

Wouldn't it save the user one click to select what card they've got?

There's no need for the user to select it. Just collect the numbers and send it off to your payment gateway. If the card type is unsupported, which would be rare for anyone using a standard gateway that supports all major cards, then display an error message.

In the UK it is quite common to not accept AMEX and other cards such as whatever 'Maestro' is. Therefore you do have to show what you do accept so people know to use a sensible-to-the-retailer card.

Re: How to Correctly Detect Credit Card Type

#46

$299!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

How many develop hours do you think it takes to get a full feature checkout working?

From the comments here I believe that some more work is needed for the card detection, however, to 'roll your own' with your employer paying? Could cost more than $299.

Personally I think there is a lot to be said for basic checking and having a drop-down for the card type with the accepted card types spelt out for people. Oh, and with a Paypal option for those that don't like putting their card details into random websites.

Post reply on HN