flid2 Posted February 10, 2015 Share Posted February 10, 2015 (edited) I have a shop set up in Canada with tax set at 5%. When using PayPal to check out, it gives an error Error Code: 10426. I spoke to PayPal and figured out that the problem is that PayPal will only deal with 2 decimal places. If I have something for sale for $1.00 and charge tax of 5%, the total will be $1.05 and will work. If I charge $0.99 and charge tax of 5%, the total will be $1.0395 and won't work because there are too many decimal places. How can I fix this so that I don't have to worry about all my prices working out to only 2 decimal places? Edited February 11, 2015 by flid2 (see edit history) Link to comment Share on other sites More sharing options...
igalfsg Posted May 27, 2015 Share Posted May 27, 2015 did you find a solution to this? Link to comment Share on other sites More sharing options...
evelcom Posted May 31, 2015 Share Posted May 31, 2015 I'm in the same situation. I believe Prestashop is suck. Any thing don't work. Install and reinstall. Open cart is a much better ecommerce piece of software. Is a week now I'm trying to resolve this Paypal issue. Nothing can help me to resolve. This will be the last chance to ask for help then I will move to Open cart. (Open cart use only your email account for paypal) Link to comment Share on other sites More sharing options...
ash-f Posted June 6, 2015 Share Posted June 6, 2015 This is caused by none 2digit decimal amount. If Paypal Payment Standard, Edit /modules/paypalusa/views/templates/hook/standard.tpl change <input type="hidden" name="amount_{$smarty.foreach.paypal_usa_products.index+1|escape:'htmlall':'UTF-8'}" value="{$paypal_usa_total_shipping|floatval}" /> to <input type="hidden" name="amount_{$smarty.foreach.paypal_usa_products.index+1|escape:'htmlall':'UTF-8'}" value="{$paypal_usa_product.price|floatval|number_format:2}" /> Same goes to Express and Professional, I guess. Link to comment Share on other sites More sharing options...
pixelwebmx Posted June 23, 2015 Share Posted June 23, 2015 I have a shop set up in Canada with tax set at 5%. When using PayPal to check out, it gives an error Error Code: 10426. I spoke to PayPal and figured out that the problem is that PayPal will only deal with 2 decimal places. If I have something for sale for $1.00 and charge tax of 5%, the total will be $1.05 and will work. If I charge $0.99 and charge tax of 5%, the total will be $1.0395 and won't work because there are too many decimal places. How can I fix this so that I don't have to worry about all my prices working out to only 2 decimal places? We had a similiar situation. We used two currency in the same site, the problem was that money exchange MXN > USD was 15.39902. We fixed this change this value currency to 15.40 Link to comment Share on other sites More sharing options...
egzibeo Posted June 29, 2015 Share Posted June 29, 2015 "This is caused by none 2digit decimal amount. If Paypal Payment Standard, Edit /modules/paypalusa/views/templates/hook/standard.tpl change <input type="hidden" name="amount_{$smarty.foreach.paypal_usa_products.index+1|escape:'htmlall':'UTF-8'}" value="{$paypal_usa_total_shipping|floatval}" /> to <input type="hidden" name="amount_{$smarty.foreach.paypal_usa_products.index+1|escape:'htmlall':'UTF-8'}" value="{$paypal_usa_product.price|floatval|number_format:2}" /> Same goes to Express and Professional, I guess." Ash-f was right about changing the code for standard, it works, I just tried it BUT IT DOES NOT WORK FOR EXPRESS. If any of you knows how to modify the code for express paypal checkout I'd greatly appreciate it Link to comment Share on other sites More sharing options...
ash-f Posted June 29, 2015 Share Posted June 29, 2015 I know how to fix Paypal Express but I didn't know somebody is still interested. modify this file /modules/paypalusa/controllers/front/expresscheckout.php wrap any variable that is cast as float with number_format() example change (float)$product['price_wt'] to number_format((float)$product['price_wt'],2) 1 Link to comment Share on other sites More sharing options...
egzibeo Posted June 29, 2015 Share Posted June 29, 2015 I'll try, thanks, not sure though whether I see any variables in that form Link to comment Share on other sites More sharing options...
egzibeo Posted June 29, 2015 Share Posted June 29, 2015 Ash-f these are all the lines I have that contain "float" <input id="paypal-express-checkout-btn" type="image" name="submit" src="{$module_dir}img/boton_terminar_compra.png" alt="" style="vertical-align: middle; margin-right: 10px;float: left;" /> <p style="line-height: 50px; float: left;">{l s='Da clic para confirmar tu compra con PayPal' mod='paypalusa'}</p> <input id="paypal-express-checkout-btn-product" type="image" name="submit" src="{if isset($paypal_usa_express_checkout_no_token) && $paypal_usa_express_checkout_no_token}{$module_dir}/img/accpmark_tarjdeb_mx.png{else}{$module_dir}/img/express_checkout_mx.png{/if}" alt="" style="float: left;"/> $('#paypal-express-checkout-btn-product').css('float', 'left'); $('#paypal-express-checkout-btn-product').css('float', 'right'); All I gave you above is extracted lines that contain the float part.....don't see anywhere the variable "price" nor "amount" mentioned. Can you help? Thanks a lot! Link to comment Share on other sites More sharing options...
ash-f Posted June 29, 2015 Share Posted June 29, 2015 check line 96,115 and 279. possibly problem caused by only these lines. 2 Link to comment Share on other sites More sharing options...
ash-f Posted June 29, 2015 Share Posted June 29, 2015 96 '&L_PAYMENTREQUEST_0_AMT'.$i.'='.urlencode((float)$product['price_wt']). 115 '&PAYMENTREQUEST_0_ITEMAMT='.(float)$total; 279 if ($this->paypal_usa->validateOrder((int)$this->context->cart->id, (int)$order_status, (float)$result['PAYMENTINFO_0_AMT'], $this->paypal_usa->displayName, $message, array(), null, false, $customer->secure_key)) Link to comment Share on other sites More sharing options...
egzibeo Posted June 29, 2015 Share Posted June 29, 2015 Hmmm.....but what sould I do after checking them? Link to comment Share on other sites More sharing options...
ash-f Posted June 29, 2015 Share Posted June 29, 2015 modify those lines like below 96 '&L_PAYMENTREQUEST_0_AMT'.$i.'='.urlencode(number_format((float)$product['price_wt'],2)). 115 '&PAYMENTREQUEST_0_ITEMAMT='.number_format((float)$total,2); 279 if ($this->paypal_usa->validateOrder((int)$this->context->cart->id, (int)$order_status, number_format((float)$result['PAYMENTINFO_0_AMT'],2), $this->paypal_usa->displayName, $message, array(), null, false, $customer->secure_key)) 1 Link to comment Share on other sites More sharing options...
ash-f Posted June 29, 2015 Share Posted June 29, 2015 are you sure you are checking this file? /modules/paypalusa/controllers/front/expresscheckout.php I don't see any html code you mentioned in this file. Link to comment Share on other sites More sharing options...
egzibeo Posted June 29, 2015 Share Posted June 29, 2015 Ok, thank you so much! It's late at my place so I'll try modifying tomorrow. Can you give me line 96 as (I know from above with what to replace it) is so that I don't mismatch them? Link to comment Share on other sites More sharing options...
ash-f Posted June 29, 2015 Share Posted June 29, 2015 change '&L_PAYMENTREQUEST_0_AMT'.$i.'='.urlencode((float)$product['price_wt']). to '&L_PAYMENTREQUEST_0_AMT'.$i.'='.urlencode(number_format((float)$product['price_wt'],2)). change '&PAYMENTREQUEST_0_ITEMAMT='.(float)$total; to '&PAYMENTREQUEST_0_ITEMAMT='.number_format((float)$total,2); change if ($this->paypal_usa->validateOrder((int)$this->context->cart->id, (int)$order_status, (float)$result['PAYMENTINFO_0_AMT'], $this->paypal_usa->displayName, $message, array(), null, false, $customer->secure_key)) to if ($this->paypal_usa->validateOrder((int)$this->context->cart->id, (int)$order_status, number_format((float)$result['PAYMENTINFO_0_AMT'],2), $this->paypal_usa->displayName, $message, array(), null, false, $customer->secure_key)) Sometimes line number does not match because of line-break format. So I recommend to use search & replace function of text editors. Link to comment Share on other sites More sharing options...
egzibeo Posted July 1, 2015 Share Posted July 1, 2015 Thank you so much ash-f! I also sent you a PM. I tried it and it works! Link to comment Share on other sites More sharing options...
Aakash Tomar Posted July 2, 2015 Share Posted July 2, 2015 I have made the neccessary changes as advised here. but still facing the same problem. Here are the screeshots of the problems... And this is the error proceeding page And Looking forawrd to exect solution as i absolutely new to the implementation. Thanks for your support and co-operation in advance. Link to comment Share on other sites More sharing options...
Lukasz12379 Posted March 20, 2017 Share Posted March 20, 2017 (edited) I have the same problem, however, I am based in Europe, UK. What would the code be that I have to change for my location? Ps. I don't use the PayPal Express. Thank you Edited March 20, 2017 by Lukasz12379 (see edit history) Link to comment Share on other sites More sharing options...
bobbyz Posted May 3, 2017 Share Posted May 3, 2017 I did exactly what ash-f and it worked! thank you man. but seriously there shouldn't be an error like this right out of the box with nothing modified. Link to comment Share on other sites More sharing options...
Lukasz12379 Posted August 26, 2017 Share Posted August 26, 2017 This is caused by none 2digit decimal amount. If Paypal Payment Standard, Edit /modules/paypalusa/views/templates/hook/standard.tpl change <input type="hidden" name="amount_{$smarty.foreach.paypal_usa_products.index+1|escape:'htmlall':'UTF-8'}" value="{$paypal_usa_total_shipping|floatval}" /> to <input type="hidden" name="amount_{$smarty.foreach.paypal_usa_products.index+1|escape:'htmlall':'UTF-8'}" value="{$paypal_usa_product.price|floatval|number_format:2}" /> Same goes to Express and Professional, I guess. Hi there, I'm experiencing the same problem. Would you be so kind and could you please guide me step by step how I can get there to change the code - I'm new to it? I use PrestaShop1.6.1.1 and the PayPal module I use is: PayPal Payments and Gateways Paypalv3.11.4 by PrestaShop. I would be extremely grateful. Thanks Lukasz Link to comment Share on other sites More sharing options...
guixr Posted September 29, 2017 Share Posted September 29, 2017 change '&L_PAYMENTREQUEST_0_AMT'.$i.'='.urlencode((float)$product['price_wt']). to '&L_PAYMENTREQUEST_0_AMT'.$i.'='.urlencode(number_format((float)$product['price_wt'],2)). change '&PAYMENTREQUEST_0_ITEMAMT='.(float)$total; to '&PAYMENTREQUEST_0_ITEMAMT='.number_format((float)$total,2); change if ($this->paypal_usa->validateOrder((int)$this->context->cart->id, (int)$order_status, (float)$result['PAYMENTINFO_0_AMT'], $this->paypal_usa->displayName, $message, array(), null, false, $customer->secure_key)) to if ($this->paypal_usa->validateOrder((int)$this->context->cart->id, (int)$order_status, number_format((float)$result['PAYMENTINFO_0_AMT'],2), $this->paypal_usa->displayName, $message, array(), null, false, $customer->secure_key)) Sometimes line number does not match because of line-break format. So I recommend to use search & replace function of text editors. This worked for me on PS 1.6.1.10. Thank you very much!!! I'm finally able to use PayPal Express since I launched my site 3 years ago.. Issues like this shouldn't exist but thankfully it was an easy fix and there are people like you in the community. Link to comment Share on other sites More sharing options...
zaouss Posted June 10, 2018 Share Posted June 10, 2018 This worked perfectly Prestashop 1.6.1.17 ; Thank very much Ash-f 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