Jump to content

Issue with entering credit card numbers


Recommended Posts

One of my clients had a user who reported an issue with entering their credit card info. They kept getting the message "Invalid card number". We asked them for the card number and it seemed to work fine when we tested it.

This one turned out to be a sort of user issue but only sort of. There were 2 things going on here. First, they were entering the card number with spaces. The back-end code for the credit card field does strip out spaces and dashes (\IPS\nexus\CreditCard::93) but the input field itself is set to have a maxlength of 16. So when he pasted the card number in there (no I do not want to know why this person is copy/pasting card numbers, this is not my problem), it truncated it and lost a digit off the end.

The second thing that we found was that the spaces he was pasting weren't actually spaces, but some weird character. 🤷‍♀️

I would suggest altering the field validation (same location as above) to run a regex check for anything that is not a number and then throwing a very clear error message that only numbers 0-9 can be entered in the field. This seems to be the cleanest way to eliminate these kinds of errors.


Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...