Zen Cart Logo
Forums / Bug Reports / PayPal Express Checkout 'dies' when transaction declined

PayPal Express Checkout 'dies' when transaction declined

Views: 5,301

Results 1 to 2 of 2
12 Oct 2019, 19:28
#1
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

PayPal Express Checkout 'dies' when transaction declined

zc156c, PHP 7.1 (PHP-FPM).

If a PayPal Express Checkout transaction is denied (error codes 10422 or 10486), the checkout "dies" since the 'ec_redirect_url' class-variable isn't set.

      case 'DoExpressCheckoutPayment':
        if ($basicError || $_SESSION['paypal_ec_token'] != urldecode($response['TOKEN'])) {
          // there's an error, so alert customer, and if debug is on, notify storeowner
          if ($this->enableDebugging) {
            $this->_doDebug('PayPal Error Log - before_process() - EC', "In function: before_process() - Express Checkout\r\n\r\nValue List:\r\n" . str_replace('&',"\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true));
          }

          // if funding source problem occurred, must send back to re-select alternate funding source
          if ($response['L_ERRORCODE0'] == 10422 || $response['L_ERRORCODE0'] == 10486) {
            header("HTTP/1.1 302 Object Moved");
            zen_redirect($this->ec_redirect_url);
            die("Funding source problem; please go to Paypal.com (Error " . zen_output_string_protected($response['L_ERRORCODE0']) . ")");
          }