Credit card payment form showing a card number input field

About 90% of payment schemes print card numbers with 16 digits. However, the fact that 90% of cards are issued with 16 digits should not create a rule that the card number must always be 16 digits. The necessary actions should also be taken in website payment form designs for the remaining 10%.

Why do e-commerce sites show an invalid card warning with Amex cards?

This is a point that is overlooked by many websites. As a result, some cardholders end up abandoning their purchase because they cannot complete payment. When American Express card details are entered into a payment form, warnings such as "Please enter a 16-digit card number" or "Invalid card number" are often encountered. This is because American Express cards are printed with 15 digits. In this case, it becomes important to manage the requirement for entering a 16-digit card number on the payment page on a per-scheme basis, taking general usage into account.

Card number validation on the payment form

American Express cards are generally 15 digits; some Diners and Maestro cards are also a different length. Card numbers can go up to as many as 19 digits.

The form should validate length dynamically based on the scheme and perform a Luhn check. An incorrect validation rule causes a user's valid card to be rejected.

Automatically stripping spaces and dashes entered by the user also reduces the error rate.