Identify if a "Credit card" or "Debit card" by the card number [duplicate]
Asked Answered
P

1

12

I can initially do a check to identify if I have a valid Payment Card Number by performing Luhn check algorithm.

But then I need to identify if it is a Credit card or a Debit card to perform the next task accordingly. I understand this depends on the first four characters, but I'm not sure about the exact ranges.

If someone can explain or provide with a link which explains this would be great. Thanks.

Edits...

In both these stackoverflow Links I don't see my question is answered. Therefore this can not be a duplicate for any of these.

In my case it doen't read the card using a card reader and instead using the card number, CVV and exp date to get the payment done(User insert these things).

Also "yes" I can do a check to identify if it is a Visa card, Master Card or an American Express card. But no way to find if its a Credit or a Debit card.(For example if the card is a Visa card then how will I get to know that Visa card is a "credit card" or a "debit card". That's the exact question).

Phreno answered 29/5, 2013 at 9:43 Comment(14)
Did you check this ?Imidazole
Hi The New Idiot, I checked that WikiPedia "Bank card number" thing but it doesn't say any exact logic to differentiate this two card types. Also this is not going to be a duplicate for your link as its accepted answer says reading the magnetic stripe to get more info. In my case it doen't read the card and instead user enter card number, CVV, exp date and then I have to pass all to the web service to get the payment done. Anyway thanks for your quick response.Phreno
Hi mvp, Does your link explain anything(Logic) about selecting "credit" or "debit" card type. Yes, I can check if it is an american express, Visa or master card(your link also expalin that) but still struggling selecting the exact ranges that belongs to credit and debit type. Thanks anyway.Phreno
Normally you would ask the user who entered it if you need to know. That is what most web sites do.Inga
Hi Peter Lawrey, yes it's a good way to go with. But according to the user requirement I have to check for a way to do it without allowing the user to select the option. BTW this is a mobile application in my case. Thank you.Phreno
Check this #73268Eyeglass
Hi, vishal mane. I can't find any solution in this post. For example think I have identified it as a Visa card. After that how will I check that particular visa card is a Credit or Debit card. That thing is not explained there in any of the answers. Thanks.Phreno
What about Ollie's answer?Pericope
In Ollie's answer Javascript link(eflo.net/mod10.htm)< i beleive is not accurate as When I check with a UK Visa debit card it identify it as a Visa Credit card. I am analysing the wikipedia answer.Phreno
fiy, the binbase database has worked flawlessly for me.Pericope
www.binlist.net is another service you can use and its freeDragon
@PeterKerr the binlist.net doest give accurate results. I am from india, and when i tried my debit card number , it said that card belongs to USA.Strunk
from their website: "the database is very accurate, don't expect it to be perfect."Dragon
I think it is wrong to say this is a duplicate, since the question is about the card being credit or debit. This attribute is not something you can figure out from the number.Aquatic
B
3

You cannot - unambiguously - tell the difference from just the PAN number. There is no official public database detailing this information and if the banks ever get together to make that happen they will be accused of collusion.

There are some resources online that could be used depending on what country you are in. Barclays offer a PDF document called "CARD IDENTIFICATION AND VALIDATION - Barclaycard" that is applicable to the UK but they will not offer any guarantees as to its accuracy. It is updated approximately quarterly to follow industry changes. You will have to google it as I cannot post a link to a pdf file.

By the way - just doing a LUHN check is not enough because the LUHN check is also used for many other numbers, EAN13 barcodes for example.

Brownson answered 29/5, 2013 at 9:50 Comment(2)
Hi OldCurmudgeon, Thanks for your answer. Didn't find this before. Yes this application mainly will be using in UK but should be okay for international cards as well. I will have a deep look in this.Phreno
I disagree. I don't think they'd be accused of collusion if they made some way to identify debit vs credit cards. They already follow lots of standards, and they don't issue cards that can have the same numbers. We can identify VISA vs MasterCard based on the number alone. They could have used numbering schemes that overlapped but they chose to cooperate a little and keep the numbering unique.Extrinsic

© 2022 - 2025 — McMap. All rights reserved.