Jump to content

Paypal Rounding Error


dirtydiscodays

Recommended Posts

Hello,

 

Stats:

Prestashop 1.5.4.0

Paypal Module 3.4.7 (most up to date, no option for upgrade on backend)

 

I am getting 2 different prices in regards to my shopping cart and when the price gets transferred to Paypal for payment. Often happens when more than one quantity of a particular item is ordered. I am assuming it has something to do with the rounding of taxes (8.75%).

 

Does anyone know of a solid fix for this?

 

Prestashop = $210.62

PayPal        = $210.60

 

 

Thanks for any help!!!

post-719801-0-41489300-1382470585_thumb.png

post-719801-0-55908400-1382470586_thumb.png

Link to comment
Share on other sites

paypal does not round...or in anyway modify the pricing...

 

did you modify the native prestashop rounding?

 

El Patron,

 

We have not modified the native rounding in Prestashop, But when I select through the (3) rounding types in Prestashop, they all end up as different amounts than show up in Paypal.

 

Have you not ever heard of this happening before?

 

Thanks for any insight!

Link to comment
Share on other sites

paypal does not round...or in anyway modify the pricing...

 

did you modify the native prestashop rounding?

 

Here are some examples...... With the weird rounding.... Any ideas?

 

Ex1) 6 x SKU 2000302 ($29.98) = $179.88 + (8.75% tax) $15.7395 = $195.6195 ($195.62 Prestashop) but Paypal authorization shows only $195.60
 
But if you take the same order and apply tax to each individual item, and round down for each before adding them you get this:
$29.98 + $2.62325 = $32.60325 x 6 = $195.6195
$29.98 + $2.62 = $32.6 x 6 = $195.6
 
 
 
Ex2) 2 x SKU 3000182 ($389.98) = $779.96 + (8.75% tax) $68.2465 = $848.2065 ($848.21 Prestashop) but Paypal authorization shows only $848.20
 
But if you take the same order and apply tax to each individual item, and round down for each before adding them you get this:
$389.98 + $34.12325 = $424.10325 x 2 = $848.2065
$389.98 + $34.12 = $ $424.1 x 2 = $848.2
Link to comment
Share on other sites

  • 1 year later...

Did you find solution for this?

 

This is still happening in PS 1.6.0.8 and PayPal 3.10.1. Other payment methods (SagePay, check) send the correct value. There is no problem if you set Price display method to Tax included (Customers -> Groups -> Price display method) but when you set Price display method to Tax excluded this is when this problem appears.

 

I have been looking for solution for a while now, including contacting 202 ecommerce (202-ecommerce.com), author of the PayPal module for PrestaShop but didn't have much luck.

 

I agree with dirtydiscodays, the difference comes from different method of calculating tax. In case of PayPal the tax is calculated per each piece ordered, then rounded and finally it's multiplied by quantities. During all steps of checkout item price (tax excl.) is first multiplied by quantities, then tax is added to it and finally rounded. This is also on the invoice. The above is true if you set Price display method to Tax excluded.

 

Example from my shop:

 

First method of calculation. I believe Presta Shop uses this in case of Price display method set to Tax excluded.
1.09 * 200 = 218 (total excl. VAT)
218 * 20% = 43.60 (total VAT)
218 + 43.60 = 261.60 (Total of the order)
This value is recorded on my shop and was displayed in all steps of check out.
 
Second method of calculation. I believe PayPal module is using this
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
 
Anyone have fixed this?
 
Jacek
Link to comment
Share on other sites

O... perhaps first I will test on fresh installation to see if the issue is resolved before updating. Before I do that I will try few tweaks on current version.

 

I am trying to figure out where PayPal does the calculations. Because other payment methods (tested with SagePay and check) send the correct value from the cart I believe this must be something to do with PayPal module but I can't find it.

 

In my example product cost £22.16 (excl. VAT) * 100 (quantity) = 2,216.00 (total excl. VAT)

VAT is 20% then Total incl. VAT is £2,659.20

 

looking at Smarty Debug Console the correct value is shown in three places:

 

$total_products_wt = 2659.2

$products  total_wt => 2659.2

$lastProductAdded total_wt => 2659.2

 

When you arrive at PayPal site the value is changed to £2,659.00

It looks like rounding took place after adding VAT and multiplying by quantities.

£22.16 (excl. VAT) + 20% VAT = £26.592 (total per piece). If you round this to £26.59 and multiply by quantity of 100 the total is £2,659.00 and this is sent to PayPal.

 

I am trying to find where this calculation takes place... Perhaps I can amend it there

Link to comment
Share on other sites

  • 1 year later...

Please check out the following solution for prestashop 1.6 paypal module 3.11.1. We modified express_checkout/process.php and it worked fine. 

 

https://github.com/iqtecommerce/Prestashop-1.6-Paypal-3.11.1-rounding-decimal-places-problem-fix/blob/master/Readme.md

 

Download process.php and replace the original one.

This solution doesn't work for me.  I don't have tax enabled, so the issue only arises with a % discount.

Link to comment
Share on other sites

This solution doesn't work for me.  I don't have tax enabled, so the issue only arises with a % discount.

 

I disabled Tax and tried again and made sure there is a discount %. Although the product price was 1,53x2=3,07 in prestashop cart and paypal calculation was 3.06 the order was processed successfully and returned success status and emails.

Link to comment
Share on other sites

Prestashop 1.6.1.3,  Paypal module 3.11.1

 

I have the same problem, with Paypal reporting errors on payment due to one or 2 cents difference. Some clients thought it failed the payment and payed again.

I used MariosMag solution which worked. But it is not enough to replace process.php. This caused a 500 error on the server. It looks like there is more files edited and/or is a different version from the 3.11.1 from Paypal.  So I replaced the complete module folder because I do not know which files are edited, and it works now.

 

Just a question: And when Paypal releases a new version... we know how important it is to keep this module updated.

Maybe you want to share which files were edited and where. It will be easier to track changes.

 

Anyway, thank you MariosMag.

 

Nelson / Contacto Visual

Link to comment
Share on other sites

  • 4 weeks later...
  • 4 months later...

As far as I can tell (had no problems since trying this) PayPal does it's own calculations. It looks at the per unit price on prestashop and goes from there. So if your rounding on prestashop is per line or total then you will get issues

 

I have changed rounding to per item and had no problems since

Link to comment
Share on other sites

  • 5 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...