Why do online retailers ask for the type of card before you enter the number?

This information is coded into the card number itself, so it is redundant.

For example, any card that starts with a 4 is a Visa.
51 through 55 is MasterCard
34 or 37 is American Express.

There are quite a few longer ones, but the principle is the same: The information is in the card number.

What gives?

  • 5
    What's interesting is that usually they do know about this and use it to validate your card. For example, you can put "Visa" but put a valid MasterCard number and it will say your information is invalid.
    – Corey
    Sep 28, 2010 at 15:40
  • 2
    In programming in general, piddly implementation details like this generally don't have very strong reasons behind them one way or the other. :)
    – user296
    Oct 2, 2010 at 6:45
  • 7
    For the same reason I have to pick "United States" from a list of 200+ nations for a retailer who doesn't ship outside of the US. Jun 13, 2011 at 16:45
  • 2
    Same reason I have to enter city,state, and zip code when each zip can only be in one city. May 19, 2012 at 2:00
  • @JoeTaxpayer: Even if postal boundaries are originally drawn to match political boundaries, changing political boundaries can cause a single zip code to be split between cities. I would expect that in such cases addressing a package to either city would work just fine, but people who don't know the history of their address may get confused if a package were addressed to the "wrong" city.
    – supercat
    May 26, 2016 at 5:03

3 Answers 3


The card networks are different. Depending on the type selected, the call to the different networks are identified.

Now the website that is asking the user to input the number can parse the number and then decide as to which network it belongs and accordingly invoke the respective call.

However this would go against the principal of accepting the user input and making the right call. From a security standpoint, the website is not supposed to store/process your card info, but take it as is and pass it on for authentication to the respective network. Hence its a more clean design where by user is asked to input the type of card, and whatever value the user enters is passed on to the said network. It is now for the network to validate it and return Pass/Fail.

Plus from a UI point of you, it shows the user easily what cards are supported for payment on the said gateway. Yes this information can also be put else where, but there is no guarantee that the user would read it. Forcing him to select a value make sure that he is using a right card that is supported by the website.

  • 3
    Well, most sites use a "clearing house" that does th redirecting for them, rather than routing the transaction directly to the credit card bank. Most of the time, the clearing house WILL autodetect the routing based on the card number. Sep 28, 2010 at 16:46

American Express used to be the only issuer of Amex cards. Then they won a court case and Citibank could issue them. Questions:

  1. How confident are you that these cards would start with 34 or 37?
  2. How confident are you that someone would tell you if they didn't?
  • 2
    This answer demonstrates a lack of knowledge of how credit cards are issued. Every American Express card starts with a 34 or 37. It doesn't matter which bank issued it.
    – user91988
    Jun 13, 2019 at 14:19
  1. So they can let you know which cards they accept. If they don't take Amex, it's better to see it missing from the list than to type in the long number before finding out.
  2. Some places charge different fees depending on what kind of card you are using. This is less common in the U.S.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .