Jacek Es Posted August 12, 2015 Share Posted August 12, 2015 Hello, Prestashop v 1.6.0.8 PayPal module v 3.10.1 The issue is that for some orders (not all) paid by PayPal the amount charged by PayPal is different than on the order page or the invoice. The difference is little but this is not allowed. For example order value is £261.60 and PayPal charged £262.00. I checked in DB in ps_orders the value is £261.60 and in the ps_paypal_order is £262.00. I believe the data in ps_paypal_order is received from PayPal. I would appreciate if anyone would point me in the right direction to resolve this issue. Jacek 1 Link to comment Share on other sites More sharing options...
bellini13 Posted August 12, 2015 Share Posted August 12, 2015 Sounds like the cart total was rounded when paying on Paypal. Did you test this yourself to see if the amount is rounded before or after making the payment? Link to comment Share on other sites More sharing options...
Jacek Es Posted August 12, 2015 Author Share Posted August 12, 2015 I just tested it. The amount was £261.60 during all checkout steps and this is the correct amount. This was changed after selecting PayPal as the payment method and showed on the PayPal page as £262.00. I had another small order and the amount changed from £9.15 (Prestashop) to £9.16 (PayPal). Any idea where this may be coming from? Jacek Link to comment Share on other sites More sharing options...
Jacek Es Posted August 12, 2015 Author Share Posted August 12, 2015 (edited) I made some calculations and it looks to me that the difference comes from rounding of the VAT value The order was for 200 pieces of product that cost £1.09 (excl. VAT). The VAT is 20% First method of calculation 1.09 * 200 = 218 (total excl. VAT) 218 * 20% = 43.60 (VAT) 218 + 43.60 = 261.60 (Total) This value is recorded on my shop and was displayed in all steps of check out. Second method of calculation 1.09 * 20% = 0.218 (VAT per one piece) if you round 0.218 to 0.22 and multiply by quantities of 200 you will get: 0.22 * 200 = 44 (total amount of VAT) 1.09 * 200 = 218 (total excl. VAT) 218 + 44 = 262 (total) This value was sent to PayPal It looks to me this is where the difference comes from. Two different methods of calculation and the rounding. Anyone have idea how to fix this? Jacek Edited August 12, 2015 by Jacek Es (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted August 12, 2015 Share Posted August 12, 2015 what if you test the checkout process using bankwire or check module. Does this rounding also occur? Just trying to determine if this is a Prestashop issue, or an issue with the Paypal module you are using. Link to comment Share on other sites More sharing options...
Jacek Es Posted August 13, 2015 Author Share Posted August 13, 2015 Hello, I tested with check payment and SagePay and the amount sent is correct - the same as in the cart and during all checkout steps (£261.60). It looks that this is issue with PayPal module. I am using the PayPal Europe - Official Module v 3.10.1. Anyone knows knows how to fix this? Jacek Link to comment Share on other sites More sharing options...
Jacek Es Posted August 18, 2015 Author Share Posted August 18, 2015 Anyone knows how o fix this? Link to comment Share on other sites More sharing options...
Vickym Posted August 28, 2015 Share Posted August 28, 2015 I am having the same problem and am desperately trying to find a fix. I am also getting the following API error; Error occurred:Please try to contact the merchant: <b>PayPal response:</b> TIMESTAMP -> 2015-08-28T04:12:58Z L_ERRORCODE0 -> 10426 L_ERRORCODE1 -> 10413 L_SHORTMESSAGE0 -> Transaction refused because of an invalid argument. See additional error messages for details. L_SHORTMESSAGE1 -> Transaction refused because of an invalid argument. See additional error messages for details. L_LONGMESSAGE0 -> Item total is invalid. L_LONGMESSAGE1 -> The totals of the cart item amounts do not match order amounts. L_SEVERITYCODE0 -> Error L_SEVERITYCODE1 -> Error Error only occurring when discounts are used. Any suggestions??? Anyone??? Link to comment Share on other sites More sharing options...
Jacek Es Posted September 5, 2015 Author Share Posted September 5, 2015 ...maybe someone will give me hint how to solve it from here... PS 1.6.0.8 and PayPal v. 3.10.1 I found where PayPal makes the calculations and sends for processing. It's in modules/paypal/express_checkout/process.php lines 301 to 303 $fields['L_PAYMENTREQUEST_0_AMT'.$index] = Tools::ps_round($product['price_wt'], $this->decimals); $fields['L_PAYMENTREQUEST_0_QTY'.$index] = $product['quantity']; $total = $total + ($fields['L_PAYMENTREQUEST_0_AMT'.$index] * $product['quantity']); What causes the difference between cart value and what is sent to PayPal is rounded $product['price_wt'] (item price with tax). This is sent to PayPal. I tested and I receive error when using 3 decimal point value... so must be only 2 decimal point. My shop is setup to display prices without tax and tax is calculated during checkout. For example: Item price without tax is 22.16, tax is 20% (4.432), quantity is 100 PayPal module calculation Item price with tax = 26.592 (rounded to 26.59) Total = 26.59 * 100 = 2659.00 (this is sent to PayPal) PrestaShop calculation Total without tax = 22.16 * 100 = 2216 Total tax = 2216 * 20% = 443.20 Total = 2216 + 443.20 = 2659.20 (This is on invoice) Solution no 1 is to set the shop to display prices with tax. In this case the shop will be using the same method of calculating as PayPal, means the same value is sent to PayPal as in the cart and invoice. This is no option for me as the shop must be set to display prices without tax. I tried to modify the first line of code so I use item price without tax - $product['price'] and multiply by 1.20 (to add 20% tax). If this is not rounded to 2 decimal points ,PayPal throws error: Item amount is invalid. If it's rounded I am back in square one. $fields['L_PAYMENTREQUEST_0_AMT'.$index] = $product['price'] * 1.20; $fields['L_PAYMENTREQUEST_0_QTY'.$index] = $product['quantity']; $total = $total + ($fields['L_PAYMENTREQUEST_0_AMT'.$index] * $product['quantity']); I also tried to to add tax at the 3rd line of code but PayPal throws error that The totals of the cart item amounts do not match order amounts which is true. $fields['L_PAYMENTREQUEST_0_AMT'.$index] = $product['price']; $fields['L_PAYMENTREQUEST_0_QTY'.$index] = $product['quantity']; $total = $total + ($fields['L_PAYMENTREQUEST_0_AMT'.$index] * $product['quantity'] * 1.20); My question is... is there a way to tweak the above 3 lines of code so the correct value is sent to PayPal? Anyone have other suggestions? Link to comment Share on other sites More sharing options...
Jacek Es Posted September 6, 2015 Author Share Posted September 6, 2015 (edited) I was advised to upgrade to newer version of PS where the rounding issues were addressed... so I installed PS 1.6.0.14. I was happy to see that three Round types were available: 1. Round on each item 2. Round on each line 3. Round on the total Number 3 (Round on the total) is exactly what I want.... This works well in PrestaShop but sadly PayPal will not respect this and instead will send its own calculations for processing. The mode that PayPal uses is no 1 - Round on each item. This is coded in modules/paypal/express_checkout/process.php lines 301 to 303 (note that even if you don't use express checkout the calculations are made there). $fields['L_PAYMENTREQUEST_0_AMT'.$index] = Tools::ps_round($product['price_wt'], $this->decimals); $fields['L_PAYMENTREQUEST_0_QTY'.$index] = $product['quantity']; $total = $total + ($fields['L_PAYMENTREQUEST_0_AMT'.$index] * $product['quantity']); PayPal calculates tax per each item, then round it, then multiplies by quantities. No matter what Round type you choose in your shop PayPal will use its own... and this is where the difference in the total amount comes from. This could work if I choose Round on each item (same as PayPal uses) but this is no option for me Jacek Edited September 6, 2015 by Jacek Es (see edit history) Link to comment Share on other sites More sharing options...
Eusebio100 Posted December 21, 2015 Share Posted December 21, 2015 I have the same problem, any solution? thank. Link to comment Share on other sites More sharing options...
charlie75 Posted January 27, 2016 Share Posted January 27, 2016 I have the same problem Link to comment Share on other sites More sharing options...
Eusebio100 Posted January 31, 2016 Share Posted January 31, 2016 It seems no one found the solution. I think it's a serious problem prestashop or paypal, very serious. Link to comment Share on other sites More sharing options...
Eusebio100 Posted January 31, 2016 Share Posted January 31, 2016 It seems nobody has prices without VAT in his tent .... or maybe not want to share the solution. I hope someone wants to help. Link to comment Share on other sites More sharing options...
Jacek Es Posted January 31, 2016 Author Share Posted January 31, 2016 Sadly the solution is not to use PayPal. I spoke with PayPal and the agency who developed the PayPal module for prestashop and they confirmed that PayPal will ALWAYS use their own calculations which is different than what is calculated on prestashop. I think I posted detailed info about this on this thread. A workaround would be to use Sagepay as they allow PayPal payments as funding sources. Good luck Link to comment Share on other sites More sharing options...
bellini13 Posted February 1, 2016 Share Posted February 1, 2016 Sadly the solution is not to use PayPal. I spoke with PayPal and the agency who developed the PayPal module for prestashop and they confirmed that PayPal will ALWAYS use their own calculations which is different than what is calculated on prestashop. I think I posted detailed info about this on this thread. A workaround would be to use Sagepay as they allow PayPal payments as funding sources. Good luck This is not a true statement. Paypal does not does not use their own calculations, they use exactly what is provided to them by the Paypal module. Link to comment Share on other sites More sharing options...
Jacek Es Posted February 1, 2016 Author Share Posted February 1, 2016 Yes, I meant PayPal module and not PayPal. The issue is that the PayPay module calculates differently than the shopping cart. Link to comment Share on other sites More sharing options...
bellini13 Posted February 1, 2016 Share Posted February 1, 2016 Yes, I meant PayPal module and not PayPal. The issue is that the PayPay module calculates differently than the shopping cart. Yes, that much is known. So why do they believe this is acceptable? Link to comment Share on other sites More sharing options...
charlie75 Posted February 1, 2016 Share Posted February 1, 2016 I have the same problem, any solution? thank. Link to comment Share on other sites More sharing options...
morgane2014 Posted February 14, 2016 Share Posted February 14, 2016 Same for me with PS 1.6.1.4 Paypal 3.10.2 Link to comment Share on other sites More sharing options...
biello Posted March 1, 2016 Share Posted March 1, 2016 Same for me with PS 1.6.0.9 Paypal 3.10.2 :/ is incredible Link to comment Share on other sites More sharing options...
sebastiano.riva Posted May 16, 2016 Share Posted May 16, 2016 (edited) Same problem on version PayPal v3.10.8 / Prestashop 1.6.1.5 Absurd error - Anyone have a solution? Phestashop Team, please tell us something Edited May 16, 2016 by sebastiano.riva (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted May 17, 2016 Share Posted May 17, 2016 Same problem on version PayPal v3.10.8 / Prestashop 1.6.1.5 Absurd error - Anyone have a solution? Phestashop Team, please tell us something Prestashop no longer maintains this module, so asking them for status is a bit pointless Link to comment Share on other sites More sharing options...
sebastiano.riva Posted May 17, 2016 Share Posted May 17, 2016 I don't know about who exactly maintains this module but it is indicated like official Prestashop Module Paypal. The problem is very strange, some amounts is calculated differently from prestashop's cart. In teory many prestashop have this problem. I hope in some upgrade Link to comment Share on other sites More sharing options...
bellini13 Posted May 18, 2016 Share Posted May 18, 2016 The addon page states "Developed by 202 ecommerce", which is an 'official partner'. Prestashop originally created the module, but no longer maintains it. http://addons.prestashop.com/en/1748-paypal.html Link to comment Share on other sites More sharing options...
sebastiano.riva Posted May 18, 2016 Share Posted May 18, 2016 (edited) I wrote an mail on official site of company. I Hope in some feedback Edited May 18, 2016 by sebastiano.riva (see edit history) Link to comment Share on other sites More sharing options...
Zebx Posted May 19, 2016 Share Posted May 19, 2016 Hi, Maybe you could take a look a this : https://github.com/Zebx/Paypal3.6.8/commit/58cde2bb6752c819619713c65c9deb1970c34f83 This is a fix I did 2 years ago for PS 1.5.6.2 and Paypal 3.6.8 (works only for shops displaying prices without tax, where VAT is always applied on transport, and without wrapping gift option) I don't know if it can still be applied as it is on the latest paypal version, but you can perhaps get inspired. Original discussion thread in French : https://www.prestashop.com/forums/topic/331068-bug-paypal-368-ou-37-et-paniers-hors-taxes/ Fyi, 202-ecommerce knows the bug and knows the way how to fix it, but it seems it is not high priority for them Link to comment Share on other sites More sharing options...
KevinNash Posted May 19, 2016 Share Posted May 19, 2016 (edited) Hello, the solution is to make Prestashop calculate as Paypal do, let's do it : In classes/cart.php replace : $total_price = Tools::ps_round($total_price + $total_ecotax, 2); by : $total_price = Tools::ps_round($product['price_wt'] * (int)$product['cart_quantity'], 2); That's all, now Paypal will charge the same value as prestashop Edited December 6, 2016 by KevinNash (see edit history) Link to comment Share on other sites More sharing options...
sebastiano.riva Posted May 20, 2016 Share Posted May 20, 2016 (edited) Thanks for the responses, but in Prestashop 1.6.1.5 there is no line $total_price = Tools::ps_round($total_price + $total_ecotax, 2); in /classes/Cart.php Edited May 20, 2016 by sebastiano.riva (see edit history) Link to comment Share on other sites More sharing options...
KevinNash Posted May 20, 2016 Share Posted May 20, 2016 It is like that on PS 1.5 at least Link to comment Share on other sites More sharing options...
ukbaz Posted May 24, 2016 Share Posted May 24, 2016 It Laso overrides shipping address using PayPal Pro bug report here: http://forge.prestashop.com/browse/PNM-3786? This module has WAY too many bugs Someone at Prestashop needs to look into this 'official partner' module !! Link to comment Share on other sites More sharing options...
sebastiano.riva Posted May 26, 2016 Share Posted May 26, 2016 anyone have a patch for Prestashop 1.6.1.5? Thanks Link to comment Share on other sites More sharing options...
maximilian8777 Posted September 19, 2016 Share Posted September 19, 2016 any news, any update? Link to comment Share on other sites More sharing options...
FerrA Posted October 4, 2016 Share Posted October 4, 2016 Same problem. Any solutions? Link to comment Share on other sites More sharing options...
sebastiano.riva Posted October 18, 2016 Share Posted October 18, 2016 Today I updated the module on version 3.11.1. The problem still remain. I also wrote to module owner many days ago, but nobody respoded me. 2 Link to comment Share on other sites More sharing options...
FerrA Posted November 3, 2016 Share Posted November 3, 2016 Today I updated the module on version 3.11.1. The problem still remain. I also wrote to module owner many days ago, but nobody respoded me. Me too, I have contact the module developers but not get a response! Any solution?? Link to comment Share on other sites More sharing options...
brrt Posted November 7, 2016 Share Posted November 7, 2016 +1 whats making this bug specially annoying is that the money will be sent, but the customer gets a notification that there was an error with the payment, leading to customers doing the same order again, because they have no clue what happened and do not recognise that the money has been sent. a ticket regarding this issue is open on github since Feb 2016 - no reaction from the developers by now. i am sure there has been put a lot of efforts into this module, but it seems that it lacks of continous support, sad but true Link to comment Share on other sites More sharing options...
savan Posted November 9, 2016 Share Posted November 9, 2016 Same problem on Prestashop 1.6.1.7 and Paypal module 3.11.1Any solutions? Thanks Link to comment Share on other sites More sharing options...
babyewok Posted November 11, 2016 Share Posted November 11, 2016 This is unbelievable! I opened a forge issue, a forum thread and comtacted the developer directly and have had no response! I can't belive it is being ignored when so many others are having a problem On another thread, this was offered as a solution: https://github.com/iqtecommerce/Prestashop-1.6-Paypal-3.11.1-rounding-decimal-places-problem-fix/blob/master/Readme.md but it doesn't work for me! Still the info seems correct at paypal, but then 'fails' in PS due to mismatching amounts. The payment is taken my PayPal though. We do not have tax enabled, so this only occurs when a % discoutn is involved. When PayPal has taken the paymen the discount is ignored too (as well as the amount difference). Link to comment Share on other sites More sharing options...
KevinNash Posted November 12, 2016 Share Posted November 12, 2016 Where is the other thread you are talking about please ? Link to comment Share on other sites More sharing options...
PrestanceDesign Posted November 12, 2016 Share Posted November 12, 2016 Hi, You can try to change the round type in preference menu. http://doc.prestashop.com/display/PS16/General+Preferences Round on each item option seems calculate like Paypal do. Link to comment Share on other sites More sharing options...
savan Posted November 16, 2016 Share Posted November 16, 2016 Hello everyone. I've had 202-ecommerce news by email requesting access to my back office and ftp. I just sent them the data. I hope they solve the problem or do it in the next version of the Paypal module.I keep you informed. Bye 1 Link to comment Share on other sites More sharing options...
babyewok Posted November 21, 2016 Share Posted November 21, 2016 Here: https://www.prestashop.com/forums/topic/283765-paypal-rounding-error/ Link to comment Share on other sites More sharing options...
savan Posted November 21, 2016 Share Posted November 21, 2016 Thanks Babyewok. But that solution is just so that no error in payment for the difference in amount. It does not solve the real problem that is that Paypal takes the prices per line with only two decimal rounding and not in the total as it should be. Something so basic I do not know how they have not solved it for a long time, and if it is not possible to solve, they remove the Prestashop contributors module. I was asked for access days ago since 202 eccomerce and I think they have not connected. Link to comment Share on other sites More sharing options...
costelc Posted November 29, 2016 Share Posted November 29, 2016 Hi. Anyone got a hold of the module developers? There are so many of us with this problem, these related posts are watched >4000 times, and still they don't come with a upgrade/solution? It's such a pity that these small things make what could be a nice story (Prestashop) not that great, especially when they trust the developers to consider this an "Official", "by Prestashop" module... 2 Link to comment Share on other sites More sharing options...
savan Posted December 6, 2016 Share Posted December 6, 2016 Hi. After three weeks, 202 ecommerce support has not been connected to my site. They do not care about the problems of their module or do not know how to solve it. Any free alternative to pay with a card similar to Paypal? Thanks Bye Link to comment Share on other sites More sharing options...
brrt Posted December 6, 2016 Share Posted December 6, 2016 After three weeks, 202 ecommerce support has not been connected to my site. They do not care about the problems of their module or do not know how to solve it. After changing the rounding within the prestashop settings to "round per item" we had no more problems, have you tried this? Any free alternative to pay with a card similar to Paypal? For creditcard payment i would recommend this free stripe module: https://github.com/firstred/mdstripe In comparision to other cc-payment "solutions" stripe offers very good conditions. Link to comment Share on other sites More sharing options...
sebastiano.riva Posted December 6, 2016 Share Posted December 6, 2016 Nobody can post a temporary workaround in the prestashop core for Prestashop 1.6.x like post #28? Link to comment Share on other sites More sharing options...
Philip22 Posted December 13, 2016 Share Posted December 13, 2016 (edited) It looks like Prestance design #41 is correct, but also seems that the module rounds up to the nearest higher number, so the rounding options I'm testing are: Round on each item Round up to the nearest value Prestashop 1.6.0.14 / Module Paypal 3.11.1 Edited December 13, 2016 by Philip22 (see edit history) 1 Link to comment Share on other sites More sharing options...
sebastiano.riva Posted December 14, 2016 Share Posted December 14, 2016 I tried with this combination (post #49) and with this price situation: tot no VAT: 3,28€ Tax: 0,72€ Tot: 4,00€ The system returns the same error. Any suggestion? Link to comment Share on other sites More sharing options...
Philip22 Posted December 14, 2016 Share Posted December 14, 2016 sebastiano.riva 20% tax on 3,28€ = 0.656 € total 3,936 € round up = 4.00 € what is the exact price ext. VAT or each article? is there more than one article? what does paypal calculate? Link to comment Share on other sites More sharing options...
sebastiano.riva Posted December 15, 2016 Share Posted December 15, 2016 My situation is: 1 product in the cart Product detail: tot no VAT: 3.278600€ VAT 22% Total: 4,00€ Default config or: Round on each item Round up to the nearest value Paypal return me the error Link to comment Share on other sites More sharing options...
Philip22 Posted December 15, 2016 Share Posted December 15, 2016 sorry, I'm using 20%TVA what does Paypal count? 4 / 1.22 = 3.278688 3.2786 * 1.22 = 3,999892 Link to comment Share on other sites More sharing options...
sebastiano.riva Posted December 15, 2016 Share Posted December 15, 2016 I don't know exactly, but the problem for me is what Prestashop sends and what PayPal receive. PayPal don't receives what wants and returns an error. I don't know if the problem is VAT but I can change it, for you is a % of VAT? Thanks Link to comment Share on other sites More sharing options...
Philip22 Posted December 15, 2016 Share Posted December 15, 2016 it's not Prestashop, it's the Paypal module. The Paypal module calculates differently than other payment methods but nobody knows how exactly... when I asked for the Paypal calculation, I meant what does Paypal show when you get to the Paypal gateway, for example: Link to comment Share on other sites More sharing options...
sebastiano.riva Posted December 15, 2016 Share Posted December 15, 2016 I can't arrive on PayPal, when I click on the banner appear the following error: Please try to contact the merchant: <b>PayPal response:</b> TIMESTAMP -> 2016-12-15T17:04:45Z L_ERRORCODE0 -> 10426 L_ERRORCODE1 -> 10431 L_ERRORCODE2 -> 10413 L_SHORTMESSAGE0 -> Transaction refused because of an invalid argument. See additional error messages for details. L_SHORTMESSAGE1 -> Transaction refused because of an invalid argument. See additional error messages for details. L_SHORTMESSAGE2 -> Transaction refused because of an invalid argument. See additional error messages for details. L_LONGMESSAGE0 -> Item total is invalid. L_LONGMESSAGE1 -> Item amount is invalid. L_LONGMESSAGE2 -> The totals of the cart item amounts do not match order amounts. L_SEVERITYCODE0 -> Error L_SEVERITYCODE1 -> Error L_SEVERITYCODE2 -> Error Link to comment Share on other sites More sharing options...
Philip22 Posted December 15, 2016 Share Posted December 15, 2016 (edited) um, sorry I can't help, there seems to be something else going on. The solution I mentioned above appears to be working for my customer so far - 13 payments correct since I made the change. The only real solution will be when Prestashop get off their backsides and provide a working Paypal module that simply sends the invoice total instead of doing it's own arcane calculations. Prestashop are you reading this? Fix it before people move to alternative ecommerce solutions. Edited December 15, 2016 by Philip22 (see edit history) 1 Link to comment Share on other sites More sharing options...
Raitis Posted January 2, 2017 Share Posted January 2, 2017 I have the same problem ... different PayPal calculations! I realize that only when put products on sale. I don`t use decimals because use round prices. Normal Product Price: 189 On sale 50% - product Price: 94,50 - Rounding in Prestashop - Total to pay: 95 I get error because PayPal calculate: 94,50 In my case when i set Number of decimals: 2 it resolve error problem but then ugly total amount is with decimals ... PS 1.6.1.6 PayPal 3.11.1 Link to comment Share on other sites More sharing options...
charlie75 Posted January 3, 2017 Share Posted January 3, 2017 Prestashop are you reading this? Link to comment Share on other sites More sharing options...
babyewok Posted January 3, 2017 Share Posted January 3, 2017 Prestashop are you reading this? Yes, surely this is a major issue for the prestashop developers since PayPal is a major module used by many! I reported this to the forge ages ago since the Module developer refuses to help unless an issue had been opened on the forge first and NOTHING!! http://forge.prestashop.com/browse/PSCSX-8627 Link to comment Share on other sites More sharing options...
misthero Posted January 9, 2017 Share Posted January 9, 2017 (edited) similar problem here, where the module does the calculations, what file? Edited January 10, 2017 by misthero (see edit history) Link to comment Share on other sites More sharing options...
IED Factory Posted January 18, 2017 Share Posted January 18, 2017 Hi, I'm french so sorry about ma bad english. PS 1.6.1.9, last release of Paypal Module : same problem. Intermittently, the amounts are not eagles between the PS and paypal and the order is in payment error. Thanks in advance Link to comment Share on other sites More sharing options...
charlie75 Posted January 23, 2017 Share Posted January 23, 2017 Any news? Link to comment Share on other sites More sharing options...
babyewok Posted January 23, 2017 Share Posted January 23, 2017 I am starting to give up hope. They haven't even replied to my forge issue! Link to comment Share on other sites More sharing options...
Assramm (cz) Posted January 24, 2017 Share Posted January 24, 2017 I have same problem with final price ..my problem is not at products price (because in shop I dont need use decimals).. God bless;) BUT, I have still problem at shipping.. Shipping is in order page (order too) 18$, paypal show me 17.75$... I have all decimals OFF.. Please, do you have any idea, how is possible turn off decimals at Paypal?? This must work for us, if we dont need desimals.. Link to comment Share on other sites More sharing options...
Raitis Posted January 24, 2017 Share Posted January 24, 2017 I have same problem with final price ..my problem is not at products price (because in shop I dont need use decimals).. God bless;) BUT, I have still problem at shipping.. Shipping is in order page (order too) 18$, paypal show me 17.75$... I have all decimals OFF.. Please, do you have any idea, how is possible turn off decimals at Paypal?? This must work for us, if we dont need desimals.. Check Tax on Shipping ... Link to comment Share on other sites More sharing options...
saverio.cannilla Posted January 26, 2017 Share Posted January 26, 2017 (edited) Hello Everybody, I am fighting with the same issue (PayPal module v3.11.1 on Prestashop v1.6.1.4) anyway I am not sure the way PayPal calculates the price is wrong as you might have different VAT values for different products (for exemple, in Italy some types food have 4% VAT, some others 10% VAT and some others 22%) therefore, depending on what you sell, you might actually need to calculate the VAT per item rather than on the total. Having said that, my customer has a single VAT value calculated on the total amount therefore I am experiencing tha same issue with PayPal payments. I am working on the line of replacing the PayPal calculation with the value read directly from the cart, something like: // file /modules/paypal/express_checkout.php ... private function setProductsList(&$fields, &$index, &$total) { foreach ($this->product_list as $product) { $fields['L_PAYMENTREQUEST_0_NUMBER'.++$index] = (int) $product['id_product']; $fields['L_PAYMENTREQUEST_0_NAME'.$index] = $product['name']; if (isset($product['attributes']) && (empty($product['attributes']) === false)) { $fields['L_PAYMENTREQUEST_0_NAME'.$index] .= ' - '.$product['attributes']; } $fields['L_PAYMENTREQUEST_0_DESC'.$index] = Tools::substr(strip_tags($product['description_short']), 0, 50).'...'; $fields['L_PAYMENTREQUEST_0_AMT'.$index] = Tools::ps_round($product['price_wt'], $this->decimals); $fields['L_PAYMENTREQUEST_0_QTY'.$index] = $product['quantity']; // remove or comment-out the per-product calculation... // $total = $total + ($fields['L_PAYMENTREQUEST_0_AMT'.$index] * $product['quantity']); } // ... and replace it with the products subtotal read from the cart $total = $total + $this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS); // 'false' return the products subtotal excluding VAT, 'true' returns the products subtotal including VAT } ... public function getTotalPaid() { $total = 0.00; // remove or comment-out the per-product calculation... /*foreach ($this->product_list as $product) { $price = Tools::ps_round($product['price_wt'], $this->decimals); $quantity = Tools::ps_round($product['quantity'], $this->decimals); $total = Tools::ps_round($total + ($price * $quantity), $this->decimals); }*/ // ... and replace it with the products subtotal read from the cart $total = $total + $this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS), $this->decimals); // 'false' return the products subtotal excluding VAT, 'true' returns the products subtotal including VAT ... } But I have not finalized neither tested the modifications yet. If you have any comment or feedback, please share it. Thanks Edited January 26, 2017 by saverio.cannilla (see edit history) 1 Link to comment Share on other sites More sharing options...
charlie75 Posted January 26, 2017 Share Posted January 26, 2017 (edited) don't work "Transaction refused because of an invalid argument. See additional error messages for details." Edited January 26, 2017 by charlie75 (see edit history) Link to comment Share on other sites More sharing options...
FerrA Posted January 30, 2017 Share Posted January 30, 2017 Hello Everybody, I am fighting with the same issue (PayPal module v3.11.1 on Prestashop v1.6.1.4) anyway I am not sure the way PayPal calculates the price is wrong as you might have different VAT values for different products (for exemple, in Italy some types food have 4% VAT, some others 10% VAT and some others 22%) therefore, depending on what you sell, you might actually need to calculate the VAT per item rather than on the total. Having said that, my customer has a single VAT value calculated on the total amount therefore I am experiencing tha same issue with PayPal payments. I am working on the line of replacing the PayPal calculation with the value read directly from the cart, something like: // file /modules/paypal/express_checkout.php ... private function setProductsList(&$fields, &$index, &$total) { foreach ($this->product_list as $product) { $fields['L_PAYMENTREQUEST_0_NUMBER'.++$index] = (int) $product['id_product']; $fields['L_PAYMENTREQUEST_0_NAME'.$index] = $product['name']; if (isset($product['attributes']) && (empty($product['attributes']) === false)) { $fields['L_PAYMENTREQUEST_0_NAME'.$index] .= ' - '.$product['attributes']; } $fields['L_PAYMENTREQUEST_0_DESC'.$index] = Tools::substr(strip_tags($product['description_short']), 0, 50).'...'; $fields['L_PAYMENTREQUEST_0_AMT'.$index] = Tools::ps_round($product['price_wt'], $this->decimals); $fields['L_PAYMENTREQUEST_0_QTY'.$index] = $product['quantity']; // remove or comment-out the per-product calculation... // $total = $total + ($fields['L_PAYMENTREQUEST_0_AMT'.$index] * $product['quantity']); } // ... and replace it with the products subtotal read from the cart $total = $total + $this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS); // 'false' return the products subtotal excluding VAT, 'true' returns the products subtotal including VAT } ... public function getTotalPaid() { $total = 0.00; // remove or comment-out the per-product calculation... /*foreach ($this->product_list as $product) { $price = Tools::ps_round($product['price_wt'], $this->decimals); $quantity = Tools::ps_round($product['quantity'], $this->decimals); $total = Tools::ps_round($total + ($price * $quantity), $this->decimals); }*/ // ... and replace it with the products subtotal read from the cart $total = $total + $this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS), $this->decimals); // 'false' return the products subtotal excluding VAT, 'true' returns the products subtotal including VAT ... } But I have not finalized neither tested the modifications yet. If you have any comment or feedback, please share it. Thanks This changes should be applied to the right /paypal/express_checkout/process.php right?? After changes site return me to a blank page, without errors or warnings. Completely white page!! [iTA] Le modifiche vanno applicate al file di /paypal/express_checkout/process.php giusto? Dopo aver applicato le modifiche mi viene restituita una pagina bianca, senza errori e senza avvisi. Up up Link to comment Share on other sites More sharing options...
saverio.cannilla Posted February 3, 2017 Share Posted February 3, 2017 (edited) This changes should be applied to the right /paypal/express_checkout/process.php right??After changes site return me to a blank page, without errors or warnings. Completely white page!! [iTA] Le modifiche vanno applicate al file di /paypal/express_checkout/process.php giusto? Dopo aver applicato le modifiche mi viene restituita una pagina bianca, senza errori e senza avvisi. Up up Yes, the file I was working on was /modules/paypal/express_checkout/process.php but the code I posted was just a work-in-progress requiring some more thinking and testing. Currently I have put aside this issue as my boss asked me to prioritize some other tasks. [iTA] Si, il file su cui stavo lavorando è /modules/paypal/express_checkout/process.php ma il codice che ho riportato è solo una bozza che va ancora sistemata e testata. Al momento però ho accantonato il problema, perché il mio capo mi ha chiesto di occuparmi d'altro. Edited February 6, 2017 by saverio.cannilla (see edit history) 1 Link to comment Share on other sites More sharing options...
saverio.cannilla Posted February 7, 2017 Share Posted February 7, 2017 (edited) Today I had some time to think about this issue and this is what I came up with... Once again, this has not been tested yet and it is not intended to be a ready-to-use solution, it is just something to discuss and exchane ideas. If you have the possibility to test the code (I do not have access to a paypal sandbox in order to make test payments), please let me know how it goes. Thanks. #File: /modules/paypal/express_checkout/process.php #Lines of code modified: 254, 321, 342, 345, 354-356, 363, 367-379, 386-388, 408, 411-413, 416-419, 421-424, 445-481 #Code: <?php /* ...omissis... */ include_once _PS_MODULE_DIR_.'paypal/paypal.php'; include_once _PS_MODULE_DIR_.'paypal/api/paypal_lib.php'; class PaypalExpressCheckout extends Paypal { /* ...omissis... */ private function _setPaymentDetails(&$fields) { /* ...omissis... */ // Set cart products list $this->setProductsList($fields, $index, $total, $taxes); $this->setDiscountsList($fields, $index, $total, $taxes); $this->setGiftWrapping($fields, $index, $total); $this->setTaxesAmount($fields, $index, $taxes); // added separate taxes calculation (see rows 367-379) // Payment values $this->setPaymentValues($fields, $index, $total, $taxes); /* ...omissis... */ } /* ...omissis... */ private function setProductsList(&$fields, &$index, &$total) { foreach ($this->product_list as $product) { $fields['L_PAYMENTREQUEST_0_NUMBER'.++$index] = (int) $product['id_product']; $fields['L_PAYMENTREQUEST_0_NAME'.$index] = $product['name']; if (isset($product['attributes']) && (empty($product['attributes']) === false)) { $fields['L_PAYMENTREQUEST_0_NAME'.$index] .= ' - '.$product['attributes']; } $fields['L_PAYMENTREQUEST_0_DESC'.$index] = Tools::substr(strip_tags($product['description_short']), 0, 50).'...'; $fields['L_PAYMENTREQUEST_0_AMT'.$index] = $product['price']; // replaced 'price_wt' with 'price' and removed rounding $fields['L_PAYMENTREQUEST_0_QTY'.$index] = $product['quantity']; $total = $total + ($fields['L_PAYMENTREQUEST_0_AMT'.$index] * $product['quantity']); } } private function setDiscountsList(&$fields, &$index, &$total) { $discounts = (_PS_VERSION_ < '1.5') ? $this->context->cart->getDiscounts() : $this->context->cart->getCartRules(); if (count($discounts) > 0) { foreach ($discounts as $discount) { $fields['L_PAYMENTREQUEST_0_NUMBER'.++$index] = $discount['id_discount']; $fields['L_PAYMENTREQUEST_0_NAME'.$index] = $discount['name']; if (isset($discount['description']) && !empty($discount['description'])) { $fields['L_PAYMENTREQUEST_0_DESC'.$index] = Tools::substr(strip_tags($discount['description']), 0, 50).'...'; } /* It is a discount so we store a negative value */ $fields['L_PAYMENTREQUEST_0_AMT'.$index] = -1 * $discount['value_tax_exc']; // replaced 'value_real' with 'value_tax_exc' and removed rounding $fields['L_PAYMENTREQUEST_0_QTY'.$index] = 1; $total = $total + $fields['L_PAYMENTREQUEST_0_AMT'.$index]; // removed rounding } } } private function setGiftWrapping(&$fields, &$index, &$total) { if ($this->context->cart->gift == 1) { //$gift_wrapping_price = $this->getGiftWrappingPrice(); $gift_wrapping_price = $this->context->cart->getOrderTotal(false, Cart::ONLY_WRAPPING); // value VAT excluded $gift_wrapping_price_wt = $this->context->cart->getOrderTotal(true, Cart::ONLY_WRAPPING); // value VAT included (this should not be necessary) $fields['L_PAYMENTREQUEST_0_NAME'.++$index] = $this->l('Gift wrapping'); $fields['L_PAYMENTREQUEST_0_AMT'.$index] = $gift_wrapping_price; // removed rounding $fields['L_PAYMENTREQUEST_0_QTY'.$index] = 1; $total = $total + $gift_wrapping_price; // removed rounding } } /* Total taxes for the whole order (new function) */ private function setTaxesAmount(&$fields, &$index, &$taxes) { $total_taxes = $this->context->cart->getOrderTotal(true, Cart::BOTH) - $this->context->cart->getOrderTotal(false, Cart::BOTH); $fields['L_PAYMENTREQUEST_0_TAXAMT'.++$index] = $this->l('Taxes'); $fields['L_PAYMENTREQUEST_0_AMT'.$index] = $total_taxes; $fields['L_PAYMENTREQUEST_0_QTY'.$index] = 1; $fields['PAYMENTREQUEST_0_TAXAMT'] = $total_taxes; $taxes = $taxes + $total_taxes; } private function setPaymentValues(&$fields, &$index, &$total, &$taxes) { if (version_compare(_PS_VERSION_, '1.5', '<')) { $shipping_cost_wt = $this->context->cart->getOrderShippingCost(); // I am working on Prestasho 1.6 therefore I ignored this } else { //$shipping_cost_wt = $this->context->cart->getTotalShippingCost(); $shipping_cost = $this->context->cart->getOrderTotal(false, Cart::ONLY_SHIPPING); // value VAT excluded $shipping_cost_wt = $this->context->cart->getOrderTotal(true, Cart::ONLY_SHIPPING); // value VAT included (this should not be necessary) } if ((bool) Configuration::get('PAYPAL_CAPTURE')) { $fields['PAYMENTREQUEST_0_PAYMENTACTION'] = 'Authorization'; } else { $fields['PAYMENTREQUEST_0_PAYMENTACTION'] = 'Sale'; } $currency = new Currency((int) $this->context->cart->id_currency); $fields['PAYMENTREQUEST_0_CURRENCYCODE'] = $currency->iso_code; /** * If the total amount is lower than 1 we put the shipping cost as an item * so the payment could be valid. */ if ($total <= 1) { $carrier = new Carrier($this->context->cart->id_carrier); $fields['L_PAYMENTREQUEST_0_NUMBER'.++$index] = $carrier->id_reference; $fields['L_PAYMENTREQUEST_0_NAME'.$index] = $carrier->name; $fields['L_PAYMENTREQUEST_0_AMT'.$index] = $shipping_cost; // replaced '$shipping_cost_wt' with '$shipping_cost' and removed rounding $fields['L_PAYMENTREQUEST_0_QTY'.$index] = 1; $fields['PAYMENTREQUEST_0_ITEMAMT'] = $total + $shipping_cost; // removed rounding and added taxes $fields['PAYMENTREQUEST_0_TAXAMT'] = $taxes; // display taxes $fields['PAYMENTREQUEST_0_AMT'] = Tools::ps_round(($total + $shipping_cost + $taxes), $this->decimals); // calculate total and final rounding } else { if ($currency->iso_code == 'HUF') { $fields['PAYMENTREQUEST_0_SHIPPINGAMT'] = $shipping_cost; // replaced '$shipping_cost_wt' with '$shipping_cost' and removed rounding $fields['PAYMENTREQUEST_0_ITEMAMT'] = $total; // removed rounding $fields['PAYMENTREQUEST_0_TAXAMT'] = $taxes; // display taxes $fields['PAYMENTREQUEST_0_AMT'] = sprintf('%.2f', Tools::ps_round(($total + $shipping_cost + $taxes), $this->decimals)); // calculate total and final rounding, then convert into string } else { $fields['PAYMENTREQUEST_0_SHIPPINGAMT'] = $shipping_cost; // replaced '$shipping_cost_wt' with '$shipping_cost' and removed rounding $fields['PAYMENTREQUEST_0_ITEMAMT'] = $total; // removed rounding $fields['PAYMENTREQUEST_0_TAXAMT'] = $taxes; // display taxes $fields['PAYMENTREQUEST_0_AMT'] = sprintf('%.2f', Tools::ps_round(($total + $shipping_cost + $taxes), $this->decimals)); // calculate total and final rounding, then convert into string } } } /* ...omissis... */ /** * @return mixed */ public function getTotalPaid() { $total = 0.00; foreach ($this->product_list as $product) { $price = $product['price']; // replaced 'price_wt' with 'price' and removed rounding $quantity = $product['quantity']; // removed rounding $total = $total + ($price * $quantity); // removed rounding } // $total = $total + $this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS); if ($this->context->cart->gift == 1) { $total = $total + $this->getGiftWrappingPrice(); // removed rounding } // $total = $total + $this->context->cart->getOrderTotal(false, Cart::ONLY_WRAPPING); if (version_compare(_PS_VERSION_, '1.5', '<')) { $discounts = $this->context->cart->getDiscounts(); $shipping_cost = $this->context->cart->getOrderShippingCost(); } else { $discounts = $this->context->cart->getCartRules(); // $discounts = $this->context->cart->getOrderTotal(false, Cart::ONLY_WRAPPING); $shipping_cost = $this->context->cart->getTotalShippingCost(); // $discounts = $this->context->cart->getOrderTotal(false, Cart::ONLY_Shipping); } if (count($discounts) > 0) { foreach ($discounts as $product) { $price = -1 * $product['value_tax_exc']; // replaced 'value_real' with 'value_tax_exc' and removed rounding $total = $total + $price; // removed rounding } } $total_taxes = $this->context->cart->getOrderTotal(true, Cart::BOTH) - $this->context->cart->getOrderTotal(false, Cart::BOTH); // added total taxes amount return Tools::ps_round(($shipping_cost + $total + $total_taxes), $this->decimals); // calculate total and final rounding } /* ...omissis... */ } Edited February 7, 2017 by saverio.cannilla (see edit history) 1 Link to comment Share on other sites More sharing options...
sebastiano.riva Posted February 7, 2017 Share Posted February 7, 2017 You can put the entire code for easy cut and paste? Thanks Link to comment Share on other sites More sharing options...
saverio.cannilla Posted February 7, 2017 Share Posted February 7, 2017 You can put the entire code for easy cut and paste? Thanks That's the first thing I tried to do but there must be a limit on the number of characters you can post as code because when I did it, no code at all was displayed... Tomorrow I will try to post the entire file either as an attachment or as "normal" text; I cannot do it now as it's on my office desktop. Link to comment Share on other sites More sharing options...
sebastiano.riva Posted February 7, 2017 Share Posted February 7, 2017 Great! many thanks! Link to comment Share on other sites More sharing options...
FerrA Posted February 7, 2017 Share Posted February 7, 2017 That's the first thing I tried to do but there must be a limit on the number of characters you can post as code because when I did it, no code at all was displayed... Tomorrow I will try to post the entire file either as an attachment or as "normal" text; I cannot do it now as it's on my office desktop. Perfect, we wait the file for testing Link to comment Share on other sites More sharing options...
saverio.cannilla Posted February 8, 2017 Share Posted February 8, 2017 (edited) That's the first thing I tried to do but there must be a limit on the number of characters you can post as code because when I did it, no code at all was displayed... Tomorrow I will try to post the entire file either as an attachment or as "normal" text; I cannot do it now as it's on my office desktop. Ok, here it is as an attachment; just download it and change the file extension back to .php (and let me know how it goes, please ) process.txt Edited February 8, 2017 by saverio.cannilla (see edit history) Link to comment Share on other sites More sharing options...
FerrA Posted February 8, 2017 Share Posted February 8, 2017 Ok, here it is as an attachment; just download it and change the file extension back to .php (and let me know how it goes, please ) I have uploaded your process.php but I get an error: <b>PayPal response:</b> TIMESTAMP -> 2017-02-08T10:58:17Z L_ERRORCODE0 -> 11815 L_SHORTMESSAGE0 -> Transaction refused because of an invalid argument. See additional error messages for details. L_LONGMESSAGE0 -> Item sales tax is invalid L_SEVERITYCODE0 -> Error Link to comment Share on other sites More sharing options...
saverio.cannilla Posted February 8, 2017 Share Posted February 8, 2017 I have uploaded your process.php but I get an error: <b>PayPal response:</b> TIMESTAMP -> 2017-02-08T10:58:17Z L_ERRORCODE0 -> 11815 L_SHORTMESSAGE0 -> Transaction refused because of an invalid argument. See additional error messages for details. L_LONGMESSAGE0 -> Item sales tax is invalid L_SEVERITYCODE0 -> Error I see... can you try to comment-out lines 372-375 of the file I posted this morning, please? Link to comment Share on other sites More sharing options...
FerrA Posted February 8, 2017 Share Posted February 8, 2017 I see... can you try to comment-out lines 372-375 of the file I posted this morning, please? Yeeeeees!!! For now it SEEMS That works. I will make now many many tests. I have commented this lines number: 372, 373, 374 and 375 Link to comment Share on other sites More sharing options...
saverio.cannilla Posted February 8, 2017 Share Posted February 8, 2017 Yeeeeees!!! For now it SEEMS That works. I will make now many many tests. I have commented this lines number: 372, 373, 374 and 375 Great! Please let me know the result of your tests, so we know whether the solution is safe for the production server. Link to comment Share on other sites More sharing options...
charlie75 Posted February 8, 2017 Share Posted February 8, 2017 Yes, I will make now many many tests Link to comment Share on other sites More sharing options...
sebastiano.riva Posted February 10, 2017 Share Posted February 10, 2017 (edited) Today I've upgrade PayPal module at v3.11.2 on Prestashop 1.6.1.5. Then I've uploaded the modified process.php file, but the system return: <b>PayPal response:</b> TIMESTAMP -> 2017-02-10T16:25:47Z L_ERRORCODE0 -> 10426 L_ERRORCODE1 -> 10429 L_ERRORCODE2 -> 10431 L_ERRORCODE3 -> 10413 L_SHORTMESSAGE0 -> Transaction refused because of an invalid argument. See additional error messages for details. L_SHORTMESSAGE1 -> Transaction refused because of an invalid argument. See additional error messages for details. L_SHORTMESSAGE2 -> Transaction refused because of an invalid argument. See additional error messages for details. L_SHORTMESSAGE3 -> Transaction refused because of an invalid argument. See additional error messages for details. L_LONGMESSAGE0 -> Item total is invalid. L_LONGMESSAGE1 -> Tax total is invalid. L_LONGMESSAGE2 -> Item amount is invalid. L_LONGMESSAGE3 -> The totals of the cart item amounts do not match order amounts. L_SEVERITYCODE0 -> Error L_SEVERITYCODE1 -> Error L_SEVERITYCODE2 -> Error L_SEVERITYCODE3 -> Error In attachment the file with the lines commentated process.txt Edited February 10, 2017 by sebastiano.riva (see edit history) Link to comment Share on other sites More sharing options...
savan Posted February 10, 2017 Share Posted February 10, 2017 My purchase also ends with an error. PayPal module 3.11.1 and Prestashop 1.6.1.7. <b>PayPal response:</b> TIMESTAMP -> 2017-02-10T15:52:35Z L_ERRORCODE0 -> 10426 L_ERRORCODE1 -> 10431 L_ERRORCODE2 -> 10413 L_SHORTMESSAGE0 -> Transaction refused because of an invalid argument. See additional error messages for details. L_SHORTMESSAGE1 -> Transaction refused because of an invalid argument. See additional error messages for details. L_SHORTMESSAGE2 -> Transaction refused because of an invalid argument. See additional error messages for details. L_LONGMESSAGE0 -> Item total is invalid. L_LONGMESSAGE1 -> Item amount is invalid. L_LONGMESSAGE2 -> The totals of the cart item amounts do not match order amounts. L_SEVERITYCODE0 -> Error L_SEVERITYCODE1 -> Error L_SEVERITYCODE2 -> Error I have tried commenting the indicated lines and without commenting Thanks Link to comment Share on other sites More sharing options...
savan Posted February 10, 2017 Share Posted February 10, 2017 Today I've upgrade PayPal module at v3.11.2 on Prestashop 1.6.1.5. Then I've uploaded the modified process.php file, but the system return: <b>PayPal response:</b> TIMESTAMP -> 2017-02-10T14:56:58Z L_ERRORCODE0 -> 10426 L_ERRORCODE1 -> 10429 L_ERRORCODE2 -> 10431 L_ERRORCODE3 -> 11815 L_ERRORCODE4 -> 10413 L_SHORTMESSAGE0 -> Transaction refused because of an invalid argument. See additional error messages for details. L_SHORTMESSAGE1 -> Transaction refused because of an invalid argument. See additional error messages for details. L_SHORTMESSAGE2 -> Transaction refused because of an invalid argument. See additional error messages for details. L_SHORTMESSAGE3 -> Transaction refused because of an invalid argument. See additional error messages for details. L_SHORTMESSAGE4 -> Transaction refused because of an invalid argument. See additional error messages for details. L_LONGMESSAGE0 -> Item total is invalid. L_LONGMESSAGE1 -> Tax total is invalid. L_LONGMESSAGE2 -> Item amount is invalid. L_LONGMESSAGE3 -> Item sales tax is invalid L_LONGMESSAGE4 -> The totals of the cart item amounts do not match order amounts. L_SEVERITYCODE0 -> Error L_SEVERITYCODE1 -> Error L_SEVERITYCODE2 -> Error L_SEVERITYCODE3 -> Error L_SEVERITYCODE4 -> Error Check that paypal has been updated to version 3.11.2. I tried it, but it continues in version 3.11.1 and continues saying that there is an update. I do not think it is a bug in the version, but it can help who is making the modifications. Link to comment Share on other sites More sharing options...
saverio.cannilla Posted February 10, 2017 Share Posted February 10, 2017 Hello there, Thank you very much for the feedback... although it is not the kind of feedback I was hoping for. ;P I'll study the PayPal API documentation and check the file again but please consider I am not a "proper" developer working on the improvement of the PayPal module; I am just a self-taught "amateur" programmer (used to work on the front-end, with HTML\CSS\JS rather than PHP) trying to solve my employer's problem. My priority is to make my employer's online store work, focusing on the CMS and module versions he is using (PrestaShop 1.6.0.4 - PayPal 3.10.x). I am happy to share my results - if any - but please do not expect from me a solution that works with every version; as soon as I find a solution that works "for me", I will have to do other jobs. Link to comment Share on other sites More sharing options...
savan Posted February 10, 2017 Share Posted February 10, 2017 Thank you very much the contribution Severio.Cannilla. I am not a programmer and I do not understand this, but I really appreciate your work for a possible solution to my problem with paypal with rounding and decimals. I know that you are not the programmer of the module and that is why your work has more merit. Do you have the 3.10.x paypal module? I would like to try with him and your changes.Thank you very much Link to comment Share on other sites More sharing options...
saverio.cannilla Posted February 10, 2017 Share Posted February 10, 2017 Do you have the 3.10.x paypal module? I would like to try with him and your changes. Sure, I can post it on Monday, when I am back to the office. Link to comment Share on other sites More sharing options...
sebastiano.riva Posted February 11, 2017 Share Posted February 11, 2017 Thank you very much for your effort! When you upload the module you can put inside file that have you modified? I reverted at PayPal module v. 3.11.1 but don't work Thanks Link to comment Share on other sites More sharing options...
saverio.cannilla Posted February 12, 2017 Share Posted February 12, 2017 When you upload the module you can put inside file that have you modified? I'll include both and rename them as "ORIGINAL_process.php" and "MODIFIED_process.php". Link to comment Share on other sites More sharing options...
saverio.cannilla Posted February 13, 2017 Share Posted February 13, 2017 Hello Everyone, Sorry for the delay in posting the files; I've been very busy this morning. As you can see from the attached file, my version of the PayPal module is 3.11.1 (not 3.10.x, as I wrote last week - apologies for the mistake). Best regards, Saverio @FerrA and @charlie75, could you update us on the result of your tests, please? Thanks, Saverio v3.11.1-paypal-modified.zip Link to comment Share on other sites More sharing options...
saverio.cannilla Posted February 14, 2017 Share Posted February 14, 2017 (edited) Good afternoon Everybody, I finally had the chance to set-up a paypal sandbox environment for testing and, after a final review to the code, I think I finally managed to make everything work as wanted (hurray!). I made a couple of tests, including one with a discounted product and all transactions went smoothly, witout generating any payment error. I attached the file to this message, please feel free to use (it should replace "/modules/paypal/express_checkout/process.php") and let me know whether you have any problem with it. NOTE: the code has been tested on PrestaShop 1.6.1.11 with PayPal 3.11.1 Best regards, Saverio process.php process.txt Edited February 14, 2017 by saverio.cannilla (see edit history) Link to comment Share on other sites More sharing options...
savan Posted February 15, 2017 Share Posted February 15, 2017 Good morning. I appreciate your work very much, but in my case it does not work. Or it's by the Prestashop version or I have a different configuration. I was hoping that with your modifications, which take the amounts directly from the cart, will solve my problem with the rounding that the paypal module does and eliminate the problems of rounding and decimals that drag the module of paypal long time ago . From what I read, the errors I get when you install your modifications, refer to a decimal problem (10426, 10431, 10413). Thank you for sharing your contributions saverio.cannilla. Link to comment Share on other sites More sharing options...
saverio.cannilla Posted February 15, 2017 Share Posted February 15, 2017 (edited) Good morning. I appreciate your work very much, but in my case it does not work. Or it's by the Prestashop version or I have a different configuration. I was hoping that with your modifications, which take the amounts directly from the cart, will solve my problem with the rounding that the paypal module does and eliminate the problems of rounding and decimals that drag the module of paypal long time ago . From what I read, the errors I get when you install your modifications, refer to a decimal problem (10426, 10431, 10413). Thank you for sharing your contributions saverio.cannilla. If you want, I can try to have a look at it when I have some spare time; can you post a screenshot of the error and specify the version of your PrestaShop installation and PayPal module, please? Best regards, Saverio --- ADDENDUM --- Please also consider I have not even tried to develop a "universal" solution; everything I did is very focused on my emplyer's shop and it needs: display all prices - products, shipping and discounts - without VAT same VAT for all products and for the shipping display a total VAT for the entire whole order (including shipping) If you have different needs, maybe my solution can provide a strating point for your own customization but would not work "as-it-is". Edited February 15, 2017 by saverio.cannilla (see edit history) Link to comment Share on other sites More sharing options...
savan Posted February 15, 2017 Share Posted February 15, 2017 Thank you very much for everything saverio.cannilla.In my case I have all prices and discounts without VAT and the same VAT for products and discounts and shows grouped the VAT of products and transport.I have already managed to solve the problem thanks to the contribution of another colleague (https://www.prestashop.com/forums/topic/492181-ayuda-importe-cobrado-paypal-no-coincide-con-importe-pedido/?do=findComment&comment=2496865) who has extracted the solution from the blog of prestamarketing.com.Https://prestamarketing.com/blog/bug-arreglado-pedidos-pagados-paypal-dan-error-pedido-prestashop/Here they have hit the spot with the rounding and the decimals and that is exactly what happened to me. I have tried with several cases in which paypal made it bad for many euros and now makes it perfect. Even with an order I had today in which there was a difference of 3 centimos and now it does well.Thank you very much for your work, effort and dedication. 1 Link to comment Share on other sites More sharing options...
Nixnix Posted February 22, 2017 Share Posted February 22, 2017 (edited) I have already managed to solve the problem That's great! May I ask, which version of PrestaShop are you using? In your PrestaShop General Preferences, how have you set your "round mode" and "round type"? Which version of PayPal are you using? Thank you! Edited February 22, 2017 by Nixnix (see edit history) Link to comment Share on other sites More sharing options...
saverio.cannilla Posted February 22, 2017 Share Posted February 22, 2017 (edited) That's great! May I ask, which version of PrestaShop are you using? In your PrestaShop General Preferences, how have you set your "round mode" and "round type"? Which version of PayPal are you using? Thank you! Hi @Nixnix, building on the solution posted by @savan, I too have managed to solve the issue... although I had to give up displaying the detailed product list on the PayPal page. The main difference between my file and the solution posted by @savan is that, instead of reading directly from the cart only the total for the products, I do the same also for all dicounts and vauchers, the wrapping and the shipping. Furthermore I work with prices without VAT and add a "total taxes" at the end, therefore I removed all roundings but the very last for the "grand total". I attached my modified version of "/modules/paypal/express_checkout/process.php" to this post; feel free to use it, if you want (you will have to modify lines 328, 357, 379 to match your language or preferences). I put that file onto my production server last week; since then I had a few PayPal transactions, all succesful. For what concerns my store settings, we use the recommended "round up away from zero..." as round mode and "round on each line" as round type. process.php Edited February 22, 2017 by saverio.cannilla (see edit history) Link to comment Share on other sites More sharing options...
savan Posted February 23, 2017 Share Posted February 23, 2017 That's great! May I ask, which version of PrestaShop are you using? In your PrestaShop General Preferences, how have you set your "round mode" and "round type"? Which version of PayPal are you using? Thank you! Hi Nixnix The version of Prestasop I use is 1.6.1.7 and paypal 3.11.1. The rounding I use is rounding up if it has exceeded half (recommended) and total. I'm so glad it worked. Link to comment Share on other sites More sharing options...
Guest Posted March 2, 2017 Share Posted March 2, 2017 This may be a red herring, but..... We have two sites that are set up identically. Rounding the same on both. One site works fine, the other occasionally throws this payment error because PayPal has taken a different amount. I have scoured all the financial and paypal settings and all are identical. Except this: In the currency set up, the site that works has "spacing" on. The site that has an occasional problem does not have "spacing" on. I have no idea what "spacing" means. I have switched it on, and we now wait and see. But perhaps those with problem could check this setting and report back if it is "on" or "off" Link to comment Share on other sites More sharing options...
Guest Posted March 7, 2017 Share Posted March 7, 2017 This may be a red herring, but..... We have two sites that are set up identically. Rounding the same on both. One site works fine, the other occasionally throws this payment error because PayPal has taken a different amount. I have scoured all the financial and paypal settings and all are identical. Except this: In the currency set up, the site that works has "spacing" on. The site that has an occasional problem does not have "spacing" on. I have no idea what "spacing" means. I have switched it on, and we now wait and see. But perhaps those with problem could check this setting and report back if it is "on" or "off" Ah well. Not this. Another payment error today. just really weird how this is just on onesite back to the drawing board Link to comment Share on other sites More sharing options...
misthero Posted March 7, 2017 Share Posted March 7, 2017 haylau did you checked if in the order there was some kind of discont? I also have different sites, in one of them the problem appear when ther is a cart discont with a percentage % amount. fixed amount discounts are fine (probably because no extra rounding is involved) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now