If this is your first visit, check our documentation. To post, register or login.
Forums / PayPal Express Checkout support / PayPal Express Checkout issue

PayPal Express Checkout issue

Locked

Started by bruce1952 on 21 Aug 2020, 10:17 AM · Views: 3,273

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
21 Aug 2020, 10:17 AM
#1
bruce1952 avatar

bruce1952

Totally Zenned

Join Date:
Aug 2008
Location:
Sydney Australia
Posts:
828
Plugin Contributions:
0

PayPal Express Checkout issue

Hi All,

I have been using PayPal Express Check for a few years now and just recently after installing the new version of OZ post module it appears to have caused an issue (unable to confirm this).

In the past when a customer calls on the phone we process the order after creating an account and after we press the confirm order we are taken to the PayPal website and click pay by credit card.

In the past the customer details were automatically filled in and we only had to place the credit card details in and then press pay.

What is happening now is that we have to fill in the customer details Name, address, state, postcode. Note it is filling in the customers email address and phone number and that is all.

Any help would be appreciated because having to fill in the customer details is slowing us down and keeping us on the phone longer.

Outdoorking
Live Site https://www.outdoorking.com.au

2 Sep 2020, 4:01 AM
#2
jeskremer avatar

jeskremer

New Zenner

Join Date:
Nov 2008
Posts:
69
Plugin Contributions:
0

Re: PayPal Express Checkout issue

This one is driving me up a wall. I have dropped the tables for PayPal in the DB and added the 1.5.7 ones fresh, I have tried reinstalling all of the API data, but the PayPal Express payments are going through without error. I am getting stuck after the checkout on a page that won't redirect back to the website. The error confirms that I believe it is a file causing the issue:

Any suggestions or hacks are appreciated:

[01-Sep-2020 23:55:27 America/New_York] Request URI: /index.php?main_page=checkout_process, IP address: 75.128.200.52
#1  trigger_error() called at [/chroot/home/diplomas/diplomastop.com/html/includes/classes/db/mysql/query_factory.php:170]
#2  queryFactory->show_error() called at [/chroot/home/diplomas/diplomastop.com/html/includes/classes/db/mysql/query_factory.php:142]
#3  queryFactory->set_error() called at [/chroot/home/diplomas/diplomastop.com/html/includes/classes/db/mysql/query_factory.php:269]
#4  queryFactory->Execute() called at [/chroot/home/diplomas/diplomastop.com/html/includes/functions/database.php:44]
#5  zen_db_perform() called at [/chroot/home/diplomas/diplomastop.com/html/includes/modules/payment/paypalwpp.php:544]
#6  paypalwpp->after_process() called at [/chroot/home/diplomas/diplomastop.com/html/includes/classes/payment.php:261]
#7  payment->after_process() called at [/chroot/home/diplomas/diplomastop.com/html/includes/modules/pages/checkout_process/header_php.php:17]
#8  require(/chroot/home/diplomas/diplomastop.com/html/includes/modules/pages/checkout_process/header_php.php) called at [/chroot/home/diplomas/diplomastop.com/html/index.php:35]
--> PHP Fatal error: 1265:Data truncated for column 'settle_amount' at row 1 :: INSERT INTO zen_paypal (order_id, txn_type, module_name, module_mode, reason_code, payment_type, payment_status, pending_reason, invoice, first_name, last_name, payer_business_name, address_name, address_street, address_city, address_state, address_zip, address_country, address_status, payer_email, payer_id, payer_status, payment_date, business, receiver_email, receiver_id, txn_id, parent_txn_id, num_cart_items, mc_gross, mc_fee, mc_currency, settle_amount, settle_currency, exchange_rate, notify_version, verify_sign, date_added, memo) VALUES ('1628', 'cart', 'paypalwpp', 'PayPal', 'None', 'PayPal Express Checkout (instant)', 'Completed', 'None', 'EC-9YH19350A02500547', 'XXXXXXXXXXXXXXXXXXX', 'verified', '2020-09-02 03:55:26', '', 'info.xxxxxxxxxx.com', '', '9B875190NN094714B', '', '1', '18.99', '0.85', 'USD', '18.99 USD', 'USD', '1', '0', '', now(), '{Record generated by payment module}') ==> (as called by) /chroot/home/diplomas/diplomastop.com/html/includes/functions/database.php on line 44 <== in /chroot/home/diplomas/diplomastop.com/html/includes/classes/db/mysql/query_factory.php on line 170.

Just upgraded from 1.5.0 to 1.5.7. Installed the Sheffield Blue template, running php 5.6.4 due to Sheffield age.

Also, Payments Pro works fine. Express is the issue.

2 Sep 2020, 11:18 AM
#3
lat9 avatar

lat9

Administrator

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

Re: PayPal Express Checkout issue

Find the following code block in /includes/modules/payment/paypalwpp.php, starting at line 503 for the zc157 version:

    // store the PayPal order meta data -- used for later matching and back-end processing activities
    $paypal_order = array('order_id' => $insert_id,
                          'txn_type' => $this->transactiontype,
                          'module_name' => $this->code,
                          'module_mode' => MODULE_PAYMENT_PAYPALWPP_MODULE_MODE,
                          'reason_code' => $this->reasoncode,
                          'payment_type' => $this->payment_type,
                          'payment_status' => $this->payment_status,
                          'pending_reason' => $this->pendingreason,
                          'invoice' => urldecode($_SESSION['paypal_ec_token'] . (isset($this->responsedata['PPREF']) ? $this->responsedata['PPREF'] : '')),
                          'first_name' => $_SESSION['paypal_ec_payer_info']['payer_firstname'],
                          'last_name' => $_SESSION['paypal_ec_payer_info']['payer_lastname'],
                          'payer_business_name' => $_SESSION['paypal_ec_payer_info']['payer_business'],
                          'address_name' => $_SESSION['paypal_ec_payer_info']['ship_name'],
                          'address_street' => $_SESSION['paypal_ec_payer_info']['ship_street_1'],
                          'address_city' => $_SESSION['paypal_ec_payer_info']['ship_city'],
                          'address_state' => $_SESSION['paypal_ec_payer_info']['ship_state'],
                          'address_zip' => $_SESSION['paypal_ec_payer_info']['ship_postal_code'],
                          'address_country' => $_SESSION['paypal_ec_payer_info']['ship_country_name'],
                          'address_status' => $_SESSION['paypal_ec_payer_info']['ship_address_status'],
                          'payer_email' => $_SESSION['paypal_ec_payer_info']['payer_email'],
                          'payer_id' => $_SESSION['paypal_ec_payer_id'],
                          'payer_status' => $_SESSION['paypal_ec_payer_info']['payer_status'],
                          'payment_date' => trim(preg_replace('/[^0-9-:]/', ' ', $this->payment_time)),
                          'business' => '',
                          'receiver_email' => (substr(MODULE_PAYMENT_PAYPALWPP_MODULE_MODE,0,7) == 'Payflow' ? MODULE_PAYMENT_PAYPALWPP_PFVENDOR : str_replace('_api1', '', MODULE_PAYMENT_PAYPALWPP_APIUSERNAME)),
                          'receiver_id' => '',
                          'txn_id' => $this->transaction_id,
                          'parent_txn_id' => '',
                          'num_cart_items' => (float)$this->numitems,
                          'mc_gross' => (float)$this->amt,
                          'mc_fee' => (float)urldecode($this->feeamt),
                          'mc_currency' => $this->responsedata['PAYMENTINFO_0_CURRENCYCODE'],
                          'settle_amount' => (float)(isset($this->responsedata['PAYMENTINFO_0_SETTLEAMT'])) ? $this->urldecode($this->responsedata['PAYMENTINFO_0_SETTLEAMT']) : $this->amt,
                          'settle_currency' => $this->responsedata['PAYMENTINFO_0_CURRENCYCODE'],
                          'exchange_rate' => (isset($this->responsedata['PAYMENTINFO_0_EXCHANGERATE']) && urldecode($this->responsedata['PAYMENTINFO_0_EXCHANGERATE']) > 0) ? urldecode($this->responsedata['PAYMENTINFO_0_EXCHANGERATE']) : 1.0,
                          'notify_version' => '0',
                          'verify_sign' =>'',
                          'date_added' => 'now()',
                          'memo' => (sizeof($this->fmfErrors) > 0 ? 'FMF Details ' . print_r($this->fmfErrors, TRUE) : '{Record generated by payment module}'),
                         );
    zen_db_perform(TABLE_PAYPAL, $paypal_order);

    $this->notify('NOTIFY_PAYPALWPP_AFTER_PROCESS_FINISHED', $paypal_order);

and make the highlighted change (you'll need to scroll to the right):

    // store the PayPal order meta data -- used for later matching and back-end processing activities
    $paypal_order = array('order_id' => $insert_id,
                          'txn_type' => $this->transactiontype,
                          'module_name' => $this->code,
                          'module_mode' => MODULE_PAYMENT_PAYPALWPP_MODULE_MODE,
                          'reason_code' => $this->reasoncode,
                          'payment_type' => $this->payment_type,
                          'payment_status' => $this->payment_status,
                          'pending_reason' => $this->pendingreason,
                          'invoice' => urldecode($_SESSION['paypal_ec_token'] . (isset($this->responsedata['PPREF']) ? $this->responsedata['PPREF'] : '')),
                          'first_name' => $_SESSION['paypal_ec_payer_info']['payer_firstname'],
                          'last_name' => $_SESSION['paypal_ec_payer_info']['payer_lastname'],
                          'payer_business_name' => $_SESSION['paypal_ec_payer_info']['payer_business'],
                          'address_name' => $_SESSION['paypal_ec_payer_info']['ship_name'],
                          'address_street' => $_SESSION['paypal_ec_payer_info']['ship_street_1'],
                          'address_city' => $_SESSION['paypal_ec_payer_info']['ship_city'],
                          'address_state' => $_SESSION['paypal_ec_payer_info']['ship_state'],
                          'address_zip' => $_SESSION['paypal_ec_payer_info']['ship_postal_code'],
                          'address_country' => $_SESSION['paypal_ec_payer_info']['ship_country_name'],
                          'address_status' => $_SESSION['paypal_ec_payer_info']['ship_address_status'],
                          'payer_email' => $_SESSION['paypal_ec_payer_info']['payer_email'],
                          'payer_id' => $_SESSION['paypal_ec_payer_id'],
                          'payer_status' => $_SESSION['paypal_ec_payer_info']['payer_status'],
                          'payment_date' => trim(preg_replace('/[^0-9-:]/', ' ', $this->payment_time)),
                          'business' => '',
                          'receiver_email' => (substr(MODULE_PAYMENT_PAYPALWPP_MODULE_MODE,0,7) == 'Payflow' ? MODULE_PAYMENT_PAYPALWPP_PFVENDOR : str_replace('_api1', '', MODULE_PAYMENT_PAYPALWPP_APIUSERNAME)),
                          'receiver_id' => '',
                          'txn_id' => $this->transaction_id,
                          'parent_txn_id' => '',
                          'num_cart_items' => (float)$this->numitems,
                          'mc_gross' => (float)$this->amt,
                          'mc_fee' => (float)urldecode($this->feeamt),
                          'mc_currency' => $this->responsedata['PAYMENTINFO_0_CURRENCYCODE'],
                          'settle_amount' => (float)(isset($this->responsedata['PAYMENTINFO_0_SETTLEAMT'])) ? $this->urldecode($this->responsedata['PAYMENTINFO_0_SETTLEAMT']) : [B](float)[/B]$this->amt,
                          'settle_currency' => $this->responsedata['PAYMENTINFO_0_CURRENCYCODE'],
                          'exchange_rate' => (isset($this->responsedata['PAYMENTINFO_0_EXCHANGERATE']) && urldecode($this->responsedata['PAYMENTINFO_0_EXCHANGERATE']) > 0) ? urldecode($this->responsedata['PAYMENTINFO_0_EXCHANGERATE']) : 1.0,
                          'notify_version' => '0',
                          'verify_sign' =>'',
                          'date_added' => 'now()',
                          'memo' => (sizeof($this->fmfErrors) > 0 ? 'FMF Details ' . print_r($this->fmfErrors, TRUE) : '{Record generated by payment module}'),
                         );
    zen_db_perform(TABLE_PAYPAL, $paypal_order);

    $this->notify('NOTIFY_PAYPALWPP_AFTER_PROCESS_FINISHED', $paypal_order);

Apparently, the PAYMENTINFO_0_SETTLEAMT element wasn't returned by PayPal, so the $this->amt value (which has the currency-code appended) is being used. That's causing the issue, since the settle_amt field in the database is defined as a decimal value.

2 Sep 2020, 11:30 AM
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: PayPal Express Checkout issue

Fantastic catch, Cindy. Thank you.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

2 Sep 2020, 11:39 AM
#5
jeskremer avatar

jeskremer

New Zenner

Join Date:
Nov 2008
Posts:
69
Plugin Contributions:
0

Re: PayPal Express Checkout issue

Thank you so much! Took me over six hours of troubleshooting what you fixed in a matter of minutes. Much appreciated!