Credit card number is invalid

This topic contains 2 replies, has 2 voices, and was last updated by  CyberBasement Support 11 months, 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #36450

    Following a recent upgrade, we found that many, but not all, credit cards are being rejected with the message, “The entered credit card number is invalid.” We can reproduce this with several valid credit cards.

    Further digging brings us to the is_card_number_valid() function within event-organiser-authorize-net/src/CardValidator.php frequently returns false for valid cards.

    private function is_card_number_valid($card_number)

        if (strlen($card_number) > 19 || strlen($card_number) < 12) {
            return false;
        $sum    = 0;
        $parity = strlen($card_number) % 2;
        for( $i = 0; $i < strlen($card_number); $i++ ){
            $digit  = (int) $card_number[$i];
            if( $i%2 == $parity ){
                $digit = ($digit*2) % 9;
            $sum += $digit;
             return $sum % 10 === 0;

    For the moment we have modified our local copy of this function to always return TRUE and rely on to validate the card info, however a proper fix to the card number testing logic would be a preferable solution.

    CyberBasement Support

    This should be fixed in the latest version of extension (1.3.2)

    Stephen Harris

    Thanks for the fix, Stephen. Tested and working as advertised.

    CyberBasement Support
Viewing 3 posts - 1 through 3 (of 3 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.