
Credit card validator php code#
JCB :- Starting with 2131 or 1800, length 15 digits or starting with 35, length 16 digits.įollowing code blocks contain actual codes for the said credit cards validations.Diners Club :- Starting with 300 through 305, 36, or 38, length 14 digits.Discover :- Starting with 6011, length 16 digits or starting with 5, length 15 digits.MasterCard :- Starting with 51 through 55, length 16 digits.Visa :- Starting with 4, length 13 or 16 digits.American Express :- Starting with 34 or 37, length 15 digits.Here are some format of some well-known credit cards.

You can easily change a format with simply modify the regular expression which we have used for various cards. We are not sure that all the formats which we have discussed here are correct because time to time a company can change their numbering format. But there is no common format in the credit card numbering system, it varies company to company. There are various companies in financial market offer credit cards.
Credit card validator php how to#
In this page, we have discussed how to validate a credit card number (in a different format) using JavaScript. This can help to reduce the chances of errors/fraud occurring during payment processing.A validating credit card is an important point while receiving payment through an HTML form. This is because it can help you to format the credit card number correctly.


The next digits are the individual account identifier. These identify the institution that issued the card. For example, the first digit of the credit card is Major Industry Identifier (MII) and the first six digits (including MII) of a credit card number are the Issuer Identification Number (IIN) also known as Bank Identification Number (BIN). A valid credit card number has several fields and each of them has a meaning.
