Determine if there is a "credit card" or "Debit card" by card number

I can check first to determine if I have a valid payment card number by following the Luhn verification algorithm.

But then I need to determine if it is a credit card or a debit card for the next task. I understand that it depends on the first four characters, but I'm not sure about the exact range.

If someone can explain or provide a link that explains that it would be great. Thanks.

edits ...

In both of these stackoverflow links, I don't see the answer to the question. Therefore, this cannot be a duplicate for any of them.

In my case, he doesn’t read the card using a card reader and instead uses the card number, CVV and release date to receive the payment (user inserts these things).

Also β€œyes” I can check to determine if it is a Visa, Master Card or American Express. But do not find if it is a Credit or Debit . (For example, if the card is a Visa card, then how do I know if a Visa card is a "credit card" or a "debit card." Exact question).

+7
source share
1 answer

You cannot - explicitly indicate the difference only with PAN numbers. There is no official public database detailing this information, and if banks ever get together to do this, they will be charged with conspiracy.

There are several resources on the Internet that you can use depending on the country in which you are located. Barclays offers a PDF document called "IDENTIFICATION AND VALIDATION OF THE CARD - Barclaycard", applicable to the UK, but they will not provide any guarantees regarding accuracy. It is updated approximately quarterly to monitor changes in the industry. You will have to do this because I cannot publish the link to the pdf file.

By the way, just checking the LUHN is not enough, because the LUHN check is also used for many other numbers, such as EAN13 barcodes.

+2
source

All Articles