2

I need to detect the card type: Debit or Credit when the customer is on website's checkout page.

I am using the library i.e https://github.com/braintree/credit-card-type already to determine the card brand i.e Visa,Amex,Mastercard etc. But these don't provide the card type info. Is this possible at all.

2
  • Does this answer your question? How do you detect Credit card type based on number?
    – Alejandro
    Feb 8, 2021 at 18:06
  • I did go through the post but i believe the accepted answer focussed more on determining the card brands i.e Visa, Amex, MAstercard, JCB etc and not the actual card type info i.e Debit or Credit
    – jaison619
    Feb 8, 2021 at 19:02

2 Answers 2

2

Yes, it is possible. You need to get a list of BIN (Bank Identification Numbers) which correlate to card type (debit or credit). You then can compare the BIN number, which is the first 4-9 numbers of the card, to that list which will tell you the card type.

Processors like Worldpay and Card Connect make lists like this available. I am unsure if there is a cost or not. I found this free one but you'll need to massage it a bit to consume it programmatically. This API also claims to be free.

2
  • Thanks. So we can only compare against a database of BINs provided by Banks to determine if its Debit or Credit. Is it safe to assume that we cannot use some kind of pattern matching or regex to deduce from card numbers (say first 6 digits) itself that its a debit or credit like we can do to determine card brands i,e Visa, mastercard?
    – jaison619
    Feb 9, 2021 at 14:12
  • Correct for card type (credit, debit). The type of card is not "encoded" or otherwise a factor in creating card numbers. Card brands (Visa, MasterCard) can be determined by the numbers, though.
    – John Conde
    Feb 9, 2021 at 14:35
0

Another api solution at rapidapi Bank Card Bin Num Check there are 250K+ issued card type.

Just one GET request with cards first 6 number. and see result

{ "bin_number": 535177, "bank": "Finansbank A.S.", "scheme": "MASTERCARD", "type": "Debit", "country": "Turkey" }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.