Deriving Card Type

By Deane Barker on June 13, 2005

Joe and I were wondering something today: why do so many ecommerce sites ask you for your “Card Type” (Visa, MasterCard, whatever) during the checkout process?

Isn’t the card type always derivable from the number? (e.g. — MasterCard starts with five, Visa with four, Discover with six, Amex with three, etc)?

We can’t figure out why so many sites ask for this. What are we not getting?



  1. I think they’re just trying to catch up stupid fraudsters. I also think people kinda expect this (and some would be spooked if you somehow figured out that a number like “3715…” was an American Express number… just like some people were spooked when some credit card issuers used your ANR information (which they get when you call their 800 number) to look up your account without you giving any information).

  2. I assume either everyone’s doing it because everyone else is doing it (circular, pointless), or it’s an extra sanity check (you thought your Amex starts with a 5? go back and try again — this can all be done trivially on the client-side as well.) Note also that many phone transactions ask for this same piece of information.

    Now what gets me is that annoying ‘Enter your card number without spaces or dashes‘.

  3. rjt, the above poster, is right on. I wrote the new shopping cart over at from the ground up and that is exactly why I ask for the card type and then the number…to double check people. As sad as it may seem, people, on average, still have no idea how to work things on the internet. So my bosses urged me to check people on lots of things, espically during payment to cut down on them calling us and us having to call them.

    Like rjt said, a simple check of the credit card number with a equation can tell me what card they are using and if the number is valid (either client side, via Javascript or on the server side via a php script). In fact once you do chose the type and enter your number I check it to see if its valid and prompt you if its not, to save my company time and a call if you accidently give us a wrong number. Plus, the pay type question falls naturally if they choose not to pay via credit card….if they can choose “check”, they can just as easily choose “Mastercard”.

    Also, for the record, my cart doesn’t have any “Enter your card number without spaces or dashes”, it has 4 blanks that auto-tab to the next space for you.

  4. i can think of two reasons as to why they would have the ‘card type’ field:

    • to show you the list of card types that are accepted in the transaction. a fairly simple message – if ‘diners club’ isn’t an option, then you can’t pay with it
    • for data validation. it’s not really necessary, but still no harm to have… for extra cross-checking, ensure that amex starts with “34” or “37”; bankcard starts with “5610”, “560221”, “560222”, “560223”, “560224” or “560225”; masterCard with “51”, “52”, “53”, “54” or “55”; visa with “4” ; and dinersClub with “30”, “36” or “38”.


Comments are closed. If you have something you really want to say, tweet @gadgetopia.