16

How does one determine that the card a person is entering is a debit card, check card, or credit card?

I am looking at this for web payments in the US only. This is for utility billing.

Mike Wills
  • 20,959
  • 28
  • 93
  • 149
  • 15
    you ask them and they tell you. – SilentGhost Sep 25 '09 at 20:16
  • did they enter a pin number? if yes, then it's a debit card; else unknown. debit cards can be used as credit cards so it really doesnt matter anyway. – geowa4 Sep 25 '09 at 20:17
  • 3
    Debit Card == Credit Card, until you try something like renting a car. Then the differences become painfully obvious. – Robert Harvey Sep 25 '09 at 20:18
  • 2
    @geowa4, that isn't fool proof though as in the UK for instance debit cards don't need to have a PIN number entered when completing a transaction, just the 16-digit card number, – Waleed Amjad Sep 25 '09 at 20:21
  • 1
    @geowa, some credit cards now use PIN numbers as well. – Brandon Sep 25 '09 at 20:25
  • for "web payments" you can treat any card as CREDIT - it will work – roman m Sep 25 '09 at 20:31
  • @roman m, geowa4 -- maybe *you* can get away with just assuming all cards are credit cards. However, for many of us there are legal and/or professional requirements that mean we are not allowed to accept credit card payments (e.g. lawyers in some jurisdictions, local governments for tax payments in others, any service that provides credit that could later be drawn as cash in most), so the question *is* valid. – Jules Dec 16 '11 at 21:23
  • The card type can also dictate the cost of transaction processing, so it is useful to know the difference if passing the transaction cost onto the end customer. – John Rix Jan 15 '15 at 00:15

9 Answers9

7

The best code I've seen for checking a card type is a Javascript page at http://www.eflo.net/mod10.htm - can differentiate between a VISA Debit and Credit card as you requested, a long with many other variations of cards. I've ported this code to C# very easily.

Your other alternative is to acquire a copy of the BIN (Bank Identification Number) database, which is a list of all card prefixes, the card issue, and the card validation requirements (e.g. Expiry Date, Issue No, Start Date). Some BIN sources;

Ollie
  • 885
  • 1
  • 7
  • 14
  • 1
    The official BIN/IIN database is available (in theory) from the American Bankers’ Association. Unfortunately they are awkward about releasing it. – al45tair Feb 04 '14 at 13:46
  • The page linked above has been deleted from WikiPedia. For valid reasons, IMO. – MikeRoger Dec 03 '14 at 13:00
  • 2
    The link to the javascript page is no longer available, however it can be downloaded elsewhere on the site: http://eflo.net/downloads.php – Robin Layfield Dec 17 '14 at 22:25
5

not sure what you need that for, but all POS systems i'm aware of ASK THE USER to specify the type of the card.

you can run Debit as Credit - no need for pin number
you can run Credit as Debit - enter in your pin, and transaction will count as cash advance

roman m
  • 26,012
  • 31
  • 101
  • 133
  • See my comment for chaos's answer. – Mike Wills Sep 25 '09 at 20:20
  • 1
    looking at your edit: if you're writing a web-app, you might as well treat ALL CARDS AS CREDIT – roman m Sep 25 '09 at 20:29
  • I'd have to agree with your answer. All of the vendors would benefit financially from forcing the customer to run their card as debit, yet every single vendor allows the customer to make that choice (often with misleading wording that tricks the customer into selecting debit). If there were a valid way to make that determination, most vendors would force the customers with debit cards to actually run them as debit cards. – Mayo Sep 25 '09 at 20:30
  • 1
    I don't know the cost of Debit vs. Credit for processing, but I have heard in the past that debit transactions are cheaper for the vendor thus the push to debit. – Mike Wills Sep 25 '09 at 20:34
3

Wiki has lists of credit vs. debit prefixes

However, IIRC some cards may be used as both credit and debit depending on context.

DVK
  • 126,886
  • 32
  • 213
  • 327
  • Seconded; you're going to have to ask the user. Charging their card as debit will often hit the user with a fee instead of you, which will result in some upset users if you didn't ask them to make that choice. – Dean J Dec 07 '09 at 17:08
  • @Dean: What bank does that? Not in the US. The merchant is hit with all the fees... they'd rather you process it as a Debit card because the fees are LOWER –  Dec 21 '09 at 14:52
  • I don't use it as a debit card for other reasons but I'm pretty sure my US Bank card treats all debit card uses as an out-of-network ATM and will charge me a fee. However the merchant does pay less for debit card usage because of the way the networks were first set up. – bgiles Mar 17 '10 at 21:00
3

You've probably found this out already through your payment gateway but cards (debit, credit, custom [e.g store cards] are not easily distinguishable without a bit of help. Usually you can send the card number to the payment gateway and they'll give you this detail but you can work it out from a simple prefix table.

Simply put each bank/organisation is given access to a certain set of prefixes [numbers at the start] and depending on the level of detail you want you can match any card number to an organisation using the prefix. What is nice is that Debit Cards and Credit Cards use different prefixes even from the same bank.

From a web gateway point of view you don't typically care as the payment gateway will automatically tell you if they accept the card, do hotcard checks for you and validate the other information entered.

The comment (above/below) about not having to enter your pin on a debit card is wrong. That is not a debit card, sometimes referred to as Garage/Fuel Cards (where I come from) they only work for certain "fuel type transactions" to speed up processing at the forecourt.

Just Jules
  • 311
  • 2
  • 8
  • 'The comment (above/below) about not having to enter your pin on a debit card is wrong.' -@JustJules That is 100% wrong. If you have a debit card and tell them to run it as a credit, you never have to enter the pin. It is still a debit card because it takes money out of a checking account. Not sure where you got your information from. – Dylan Vander Berg Sep 03 '16 at 22:56
2

I'm thinking you are getting confused that when you swipe the card in a store the machine knows which kind of card you've got. Although with my Dutch debit card I always got the option to choose..

But I'm guessing the magnetic strip stores more than just the number, and the card readers use that to determine your type of card.

You'll just have to join the other applications/sites and ask the user :)

Stefano Borini
  • 138,652
  • 96
  • 297
  • 431
Davy Landman
  • 15,109
  • 6
  • 49
  • 73
  • The magnetic strip makes sense. – Mike Wills Sep 25 '09 at 20:24
  • 1
    There are 3 tracks with information. When I checked my VISA card I saw that it had my card-number and my name. Don't remember what else there was. – some Sep 25 '09 at 20:28
  • 2
    Here is some information about Magnetic Cards (aka credit cards) http://en.wikipedia.org/wiki/Magnetic_stripe_card. Point-of-sale card readers almost always read track 1, or track 2, and sometimes both, in case one track is unreadable. The minimum cardholder account information needed to complete a transaction is present on both tracks. Authorization for a card is described here: http://en.wikipedia.org/wiki/Authorization_hold – Chris Dec 07 '09 at 19:51
  • 1
    no, debit v. credit is not indicated in the track data. – Jeffrey Blattman Aug 22 '14 at 14:24
2

Number ranges. Here is a small excerpt of an old specification I had once.

  • 510000 - 510249 16 Now Reserved for Europay (MCS and MCG)
  • 510250 - 510399 16 Now MasterCard debit card
  • 510400 - 510549 16 Now MasterCard Electronic
  • 510550 - 510999 16 Now MasterCard debit card
  • 511000 - 511204 16 Now MasterCard debit card
  • 513000 - 513999 16 Now Reserved for Use by Europay France ICA - 1031 ONLY
  • 514130 - 514629 16 Now MasterCard debit card
  • 514630 - 514730 16 Now MasterCard Business Card (previously noted as business debit)
  • 514731 - 514740 16 Now World MasterCard (U.S.)
  • 514741 - 514760 16 Now Platinum MasterCard debit card
  • 514761 – 514800 16 Now MasterCard Standard (Proposed New Premium Product – U.S.) – 40
  • 514801 – 514815 16 Now MasterCard Standard (Proposed New Premium Product – LAC) – 15
  • 514816 - 514830 16 Now MasterCard Standard (Proposed New Premium Prodct - SAMEA) - 15

There may well be other methods by now for instance in the return message from the processor, but I have not had to deal with this for a long time. We process everything as a credit card and if the card is strictly a debit card the bank just takes care of it.

jac
  • 9,666
  • 2
  • 34
  • 63
  • From reading through your list it does appear that the actual number will determine how a credit card reader will treat the card unless the person using the card physically makes a determination. – Chris Dec 07 '09 at 19:53
2

https://binlist.net/ offers a free (rate-limited) API. You only need to enter the first 6 or 8 digits of the card number - i.e. the Issuer Identification Numbers (IIN), previously known as Bank Identification Number (BIN).

curl -H "Accept-Version: 3" "https://lookup.binlist.net/45717360"

pd12
  • 805
  • 10
  • 12
1

Binbase will tell you whether card is debit or credit based on the first six digits of the card number. You can do 10 manual lookups per day or you can pay to buy the whole database. www.binbase.com/search.html

The information returned is in this format:

Card Brand: VISA
Issuing Bank: BRANCH BANKING AND TRUST COMPANY
Card Type (Credit/Debit): DEBIT
Card Level: CLASSIC
ISO Country Name: UNITED STATES
ISO Country A2 Code: US
ISO Country A3 Code: USA
ISO Country Number: 840
Bank Website: HTTP://WWW.EXAMPLE.COM
Bank Phone: 555-555-5555 OR 800-555-5555
jjz
  • 925
  • 1
  • 13
  • 21
1

I found a Free BIN checker json API. https://api.freebinchecker.com/bin/{bin} for checking a single BIN number. It accepts a number of length six, the initial digits of any payment card. The app will perform database lookup to return all the relevant information stored for the BIN and about 350,000+ records. There also have premium feature.

You can get card type & other relevant info. No need full card number except first 6 digit.

Example:

**Request:**  
https://api.freebinchecker.com/bin/370245   

**Response:** 
{"valid":true,
"card":{  
    "status":"active",
    "brand":"VISA",
    "type":"credit",
    "category":"STANDARD",
    "sub-category":"The payment system \"Visa\""
},
"country":{  
    "name":"United States",
    "alpha-2-code":"US",
    "numeric-code":"840",
    "latitude":"37.09024",
    "longitude":"-95.712891"
},
"issuer":{  
    "name":"JPMORGAN CHASE BANK, N.A.",
    "url":"www.jpmorganchase.com",
    "tel":"1-800-565-3460-9200"
}}

For more info: Freebinchecker

AHJeebon
  • 1,218
  • 1
  • 12
  • 17