Validating credit card number length
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.
In the USA we tend to identify the card types as follows: The first 6 digits of your credit card number (including the initial MII digit) form the Issuer Identifier Number or IIN.
The IIN is also referred to as the Bank Identification Number or BIN.
It also differs from Universal Payment Identification Code, another identifier for a bank account in the United States.
The leading six digits of the card number is the "issuer identification number (IIN)", sometimes referred to as the "bank identification number (BIN)".
The card number is usually prominently embossed on the front of a payment card.
The payment card number differs from the Bank Identifier Code (BIC/ISO 9362, a normalized code—also known as Business Identifier Code, Bank International Code, and SWIFT code).
The card number is primarily a card identifier and does not directly identify the bank account number to which the card is linked by the issuing company.
The card number prefix identifies the issuer of the card, and the digits that follow identify a unique account which is associated by the issuing organization with one of its customers and then to the customer's designated bank accounts.
I recently had to write some code to process credit card orders and thought I'd share a bit of my code.