Juno Wiki & Help‎ > ‎

Magento Paypal Rounding Issue

There is a rounding issue between Paypal and Magento, which is due to be fixed in the next major release (Magento Version 1.8). Unfortunately there is no permanent fix at this time as the problem is with core Magento code when calculating tax.

However, we can explain the circumstances which cause this problem to arise, as it does only occur in specific instances. Hopefully you can then adjust your marketing to suit, or advise those customers who encounter the problem on how to proceed.

The problem occurs when tax is calculated on any value where the price amount has 5 tenths of a penny as the last figure (e.g £1.005). The value is incorrectly rounded, so the totals end up being 1 penny out, which in turn causes Paypal to reject the request.

As an example for your store, see the following basket with the 10% off code applied:
http://dev.junowebdesign.com/screenshots/2013-04-11_11-37-59.png

And the totals on checkout:
http://dev.junowebdesign.com/screenshots/2013-04-11_11-40-15.png

You will see if you add up the subtotal, discount, and shipping, the total reaches £15.25, but the total shown is £15.26. The discount amount sent to Paypal is £1.69 instead of £1.70. 10% of £16.95 is £1.695, which is the price format which triggers this bug.

A workaround is to attempt to ensure any calculated prices don't result in the 3rd and last digit of the price being a 5. So £1.6951 would be ok.

In our example, setting the coupon to not apply discount to shipping changes the prices sufficiently that the order goes through. I appreciate that guaranteeing all combinations of products do not cause this issue would be very difficult, so you'll probably want to advise customers individually to adjust their basket totals if they encounter this issue. You could for example have an 11% off code for those customers, which should adjust prices enough for their specific basket to prevent the issue.

Also, having round figure prices (that is, to the nearest pound) can also help - it may be that just rounding your shipping up to £5 would greatly reduce incidences of this problem.
Comments