Recently we came across an issue of a paypal window not functioning on a Magento 1.7 site after a site-wide 40% Off promotion began. There are likely coding /extension fixes to this issue, but we thought we’d share the simplest way to address this issue when it’s preventing users from checking out.
The Issue: The item values do not add up to the subtotal given to Paypal. The individual item prices displayed did not match the real subtotal. Magento rounds each items price to two decimal points (for USD, EUR, and others).
So, two items discounted at 40% will look like this:
Original price: 2.99 x .6 = 1.794 Price Displayed: $1.79
Original price 3.99 x .6 = 2.394 Price Displayed: $2.39
This is fine, but the Subtotal displayed is $4.19
The problem is that Magento is adding the actual values (1.794 + 2.394) to get the subtotal. When Paypal receives an order like this, it rejects the request because it does not believe 1.79 + 1.39 = 4.19. It’s receiving each item rounded to two decimal points and a subtotal that’s been calculated with up to four decimal points. These are not always the same value.
The Quick Fix: Although this solution leaves you with the problem of inconsistent numbers, it’s a quick solution to getting Paypal to accept these transactions. All you need to do is stop feeding the individual item prices to Paypal.
This is done through System > Configuration > Payment Methods > Paypal Express Checkout. Select Configure and then select No on the “Transfer Cart Line Items” dropdown:
Disabling this causes only the total to be read and displayed in Paypal. Users will still finalize their transaction on the Magento checkout page, enabling them to view a price breakdown before actually paying anything.
Ultimately, this still leaves you with prices that add up to more than the individual product sums, so it’s worth finding a more comprehensive solution. However, we should just reiterate that the subtotal is actually a correct sum, it’s just more precise than a sum of rounded sums.