• Resolved thesublimeobject

    (@thesublimeobject)


    My client has been having issues with payments going through for months now. We couldn’t figure out where the bug was originating because, quite honestly, there are a lot of different sub processes. in the end, i finally figured out that PayPal simply does NOT allow 6-digit expiration dates, but inside of class-woo-paypal-gateway-paypal-pro-payflow-api-handler.php, in the function request_do_payment(), the expiration date is added, but it’s specified as being 6-digits via a function from class-woo-paypal-gateway-paypal-pro-payflow.php on line 97 (if length is 2 it adds 2000…). this is obviously a MAJOR problem since PayPal throws an indiscriminate error that does not tell you this is the issue specifically. i fixed this for now by just using substr($card->exp_year, -2) inside of request_do_payment(), but this needs to be fixed permanently. i’m happy to write the fix myself if given access. please let me know as i don’t want anyone else to waste the hours and months i’ve spent figuring out this issue (since some of the TXs go through and others don’t, it’s really hard to figure out why it was actually happening).

Viewing 5 replies - 1 through 5 (of 5 total)
  • Tearing my hair out for weeks as well. What I finally figured out is the card with expiration 2/21 gets submitted as 2/20, and thus rejected. Looking for a fix. Would appreciated one ASAP as this would be our preferred payment method to use. Thank you.

    Hoping someone sees this. Pretty sure this is the part of the code that is converting card numbers incorrectly from 02/21 to 02/2000. I just don’t know what to change it to?

    // Format values
    $card_number = str_replace(array(‘ ‘, ‘-‘), ”, $card_number);
    $card_expiry = array_map(‘trim’, explode(‘/’, $card_expiry));
    $card_exp_month = str_pad($card_expiry[0], 2, “0”, STR_PAD_LEFT);
    $card_exp_year = isset($card_expiry[1]) ? $card_expiry[1] : ”;

    if (isset($_POST[‘pal_pro_payflow-card-start’])) {
    $card_start = wc_clean($_POST[‘pal_pro_payflow-card-start’]);
    $card_start = array_map(‘trim’, explode(‘/’, $card_start));
    $card_start_month = str_pad($card_start[0], 2, “0”, STR_PAD_LEFT);
    $card_start_year = $card_start[1];
    } else {
    $card_start_month = ”;
    $card_start_year = ”;
    }

    if (strlen($card_exp_year) == 2) {
    $card_exp_year += 2000;
    }

    if (strlen($card_start_year) == 2) {
    $card_start_year += 2000;
    }

    Actually, it is converting card numbers incorrectly from 02/21 to 02/2020.

    Commenting out all references fixed the problem.

    //if (strlen($card_exp_year) == 2) {
    //$card_exp_year += 2000;
    //}

    Needed to comment out both files:
    /…paypal-pro-payflow.php
    /…paypal-gateway-functions.php

    Plugin Author Easy Payment

    (@easypayment)

    Thank you very much for submit issue, we will look into this and resolve it very soon.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PayPal Pro Payflow Expiration Date Bugfix’ is closed to new replies.