Live data from Hacker News

How to Correctly Detect Credit Card Type

creditcardjs.com

51–60 of 67 posts

Re: How to Correctly Detect Credit Card Type

#51
The data structure they mention using is an 'inversion map' which in their case is a mapping of numeric ranges to values.

I did some quick searching and didn't find it... I wonder how they implement a key search in the inversion map. I assume you do something like populate a tree with the range transition points and then you can search in O(log n).

A search on the tree would have to find the node with the highest value that was = the requested value.

I assume the work of constructing the tree would have to be amortized over multiple searches to make it worth the effort. Could you do better than O(n) without building a tree?

In creditcardjs.com's case, they have overlapping ranges, which means you can possibly return multiple values for a given key.

Re: How to Correctly Detect Credit Card Type

#52

Hi, my credit card company is not listed there, yet it exists: my IIN is 6371. I'm afraid this is not completely accurate at all. There are many credit card IINs and those are just a very few and will not work with some international cards (including international visa cards). Those numbers are issued by the American Bankers Association - in accordance to ISO 7812. They are not attached to a credit card flag, but to…

I think you're missing the point which is just to loosely suss out the 4 or so major card brands.

Re: How to Correctly Detect Credit Card Type

#53

Earlier quoted context omitted.

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.

Maestro used to be Switch. They were popular at one time for under 18 year olds for some reason. AMEX is really seen as a premium option here in the UK, for travellers and those with rich blood.

Re: How to Correctly Detect Credit Card Type

#55
post #52

Hi, my credit card company is not listed there, yet it exists: my IIN is 6371. I'm afraid this is not completely accurate at all. There are many credit card IINs and those are just a very few and will not work with some international cards (including international visa cards). Those numbers are issued by the American Bankers Association - in accordance to ISO 7812. They are not attached to a credit card flag, but to…

I think you're missing the point which is just to loosely suss out the 4 or so major card brands.

Wouldn't that be an article called "How to loosely suss out the 4 or so major card brands" rather than "How to correctly detect credit card type"? [Their emphasis]

Re: How to Correctly Detect Credit Card Type

#56

Hi, my credit card company is not listed there, yet it exists: my IIN is 6371. I'm afraid this is not completely accurate at all. There are many credit card IINs and those are just a very few and will not work with some international cards (including international visa cards). Those numbers are issued by the American Bankers Association - in accordance to ISO 7812. They are not attached to a credit card flag, but to…

I suppose the idea is to determine the so called "card scheme" (Visa, Master, etc), not necessarily the IIN. E.g. for some payment processors, the merchant service charges are different according to the card scheme (it does't depend on the issuer). I undertand this is a simplification and it might not work for cards that don't belong to major networks, but it's good enough for a lot of businesses.

For example, if I have a business here in Japan, I doubt I could easily charge a card issued by your company (I'll be happy to be proven wrong).

Ps: brasileiro aqui.

Re: How to Correctly Detect Credit Card Type

#58

$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 wi…

It's hardly a full feature checkout..

Correct me if I'm wrong, but it just seems like a user-friendly form with client side validation. You still need to integrate it with a payment processor, hook it into your checkout process where you capture delivery, billing and order information.

I also think it's not worth $299, especially when each license is per-website only.

Re: How to Correctly Detect Credit Card Type

#59

Earlier quoted context omitted.

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.

Maestro is huge in Germany. Many people do not have CC cards, but every singe adult has an EC / Maestro card. And we are really annoyed when they don't work abroad (though they do work with ATMs worldwide in most cases).

Re: How to Correctly Detect Credit Card Type

#60

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…

This really should be the first comment in this thread.
Post reply on HN