Post by qbox » Wed Feb 20, 2019 1:33 pm

Hi,
I use built-in AustraliaPost extension to calculate postage for our user. I found if the postage is less than $10, I will get the error message as follows when I checkout the order by PayPal Express Checkout module under shipment category:

Code: Select all

Error: Error: There was an error fetching the PayPal token at eval (eval at globalEval (https://onlinestore.mrautoaustralia.com.au/catalog/view/javascript/jquery/jquery-2.1.1.min.js:2:2536), :22:21) at _loop (https://www.paypalobjects.com/api/checkout.js:5527:50) at ZalgoPromise.dispatch (https://www.paypalobjects.com/api/checkout.js:5551:57) at ZalgoPromise.resolve (https://www.paypalobjects.com/api/checkout.js:5487:22) at https://www.paypalobjects.com/api/checkout.js:5461:48 at XMLHttpRequest. (https://www.paypalobjects.com/api/checkout.js:16108:28) at Object._RECEIVE_MESSAGE_TYPE.(anonymous function) [as postrobot_message_response] (https://www.paypalobjects.com/api/checkout.js:4578:31) at receiveMessage (https://www.paypalobjects.com/api/checkout.js:4620:60) at messageListener (https://www.paypalobjects.com/api/checkout.js:4641:13)
The error message from the server log is

Code: Select all

 PayPal Express debug (Call data): 
{  
   "METHOD":"SetExpressCheckout",
   "MAXAMT":31.5,
   "RETURNURL":"https:\/\/onlinestore.mrautoaustralia.com.au\/index.php?route=extension\/payment\/pp_express\/checkoutReturn",
   "CANCELURL":"https:\/\/onlinestore.mrautoaustralia.com.au\/index.php?route=checkout\/checkout",
   "REQCONFIRMSHIPPING":0,
   "NOSHIPPING":0,
   "LANDINGPAGE":"Login",
   "LOGOIMG":null,
   "CHANNELTYPE":"Merchant",
   "PAYMENTREQUEST_0_SHIPTONAME":"Cubbic Box",
   "PAYMENTREQUEST_0_SHIPTOSTREET":"2\/74 Perrin Drive",
   "PAYMENTREQUEST_0_SHIPTOSTREET2":"",
   "PAYMENTREQUEST_0_SHIPTOCITY":"UNDERWOOD",
   "PAYMENTREQUEST_0_SHIPTOSTATE":"Queensland",
   "PAYMENTREQUEST_0_SHIPTOZIP":"4119",
   "PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE":"AU",
   "ADDROVERRIDE":1,
   "PAYMENTREQUEST_0_SHIPPINGAMT":"",
   "PAYMENTREQUEST_0_CURRENCYCODE":"AUD",
   "PAYMENTREQUEST_0_PAYMENTACTION":"Sale",
   "L_PAYMENTREQUEST_0_DESC0":false,
   "L_PAYMENTREQUEST_0_NAME0":"Penrite Auto Automatic Transmission Gearbox Stop Leak 375mL",
   "L_PAYMENTREQUEST_0_NUMBER0":"ADTSL375",
   "L_PAYMENTREQUEST_0_AMT0":19.09,
   "L_PAYMENTREQUEST_0_QTY0":"1",
   "L_PAYMENTREQUEST_0_ITEMURL0":"https:\/\/onlinestore.mrautoaustralia.com.au\/index.php?route=product\/product&product_id=106",
   "L_PAYMENTREQUEST_0_ITEMLENGTHVALUE0":"15.00000000",
   "L_PAYMENTREQUEST_0_ITEMLENGTHUNIT0":"cm",
   "L_PAYMENTREQUEST_0_ITEMWIDTHVALUE0":"15.00000000",
   "L_PAYMENTREQUEST_0_ITEMWIDTHUNIT0":"cm",
   "L_PAYMENTREQUEST_0_ITEMHEIGHTVALUE0":"15.00000000",
   "L_PAYMENTREQUEST_0_ITEMHEIGHTUNIT0":"cm",
   "L_PAYMENTREQUEST_0_NUMBER1":"shipping",
   "L_PAYMENTREQUEST_0_NAME1":"Parcel Post",
   "L_PAYMENTREQUEST_0_AMT1":8.300000000000001,
   "L_PAYMENTREQUEST_0_QTY1":1,
   "L_PAYMENTREQUEST_0_NUMBER2":"tax",
   "L_PAYMENTREQUEST_0_NAME2":"Goods Service Tax",
   "L_PAYMENTREQUEST_0_AMT2":2.74,
   "L_PAYMENTREQUEST_0_QTY2":1,
   "PAYMENTREQUEST_0_ITEMAMT":"30.13",
   "PAYMENTREQUEST_0_AMT":"30.13"
}

Unable to create Paypal session:
{  
   "TIMESTAMP":"2019-02-20T05:05:36Z",
   "CORRELATIONID":"a3ce9314c7965",
   "ACK":"Failure",
   "VERSION":"109.0",
   "BUILD":"51861407",
   "L_ERRORCODE0":"10431",
   "L_SHORTMESSAGE0":"Transaction refused because of an invalid argument. See additional error messages for details.",
   "L_LONGMESSAGE0":"Item amount is invalid.",
   "L_SEVERITYCODE0":"Error"
}
If I change the weight to make the postage be over $10, then it works fine.

Do you know what I can do to fix it? The version of Opencart is 3.0.3.1.
Thank you very much.

Newbie

Posts

Joined
Fri Jan 25, 2019 8:05 am

Post by ADD Creative » Wed Feb 20, 2019 9:09 pm

It looks like there is a rounding error on the line below.

Code: Select all

"L_PAYMENTREQUEST_0_AMT1":8.300000000000001,
What version of PHP are you using and what are 'serialize_precision' and 'precision' set to in your PHP configuration? Use phpinfo(); to find out.

www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by qbox » Sat Mar 02, 2019 7:27 pm

Thanks for your reply. The version of PHP I'm using is 5.6. The precision is 16 and serialise_precision is 100. Should I modify those two attributes? or just use round() in the PayPal module? Due to this server serves multiple web apps, I'm not sure this will affect it or not.

Newbie

Posts

Joined
Fri Jan 25, 2019 8:05 am

Post by ADD Creative » Mon Mar 04, 2019 1:41 am

Try setting precision = 14 and serialize_precision = 17, which should be the defaults for PHP 5.6.

www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by qbox » Mon Mar 04, 2019 6:47 pm

Thank you very much. It's on the web hosting, I will try it and see how it goes. By the way, my local machine is php 7 and precision is 14 as well. ;D

Newbie

Posts

Joined
Fri Jan 25, 2019 8:05 am
Who is online

Users browsing this forum: No registered users and 12 guests