View Single Post
  #1  
Old 11-18-2015, 10:38 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default PayPal cart item totals error- Solved?

Hi guys and gals,

I have spent the last 12 hours of my life stressing about a problem with XC5 and X-Payments, and I am reporting here to help others as well as get feedback on my ultimate solution.

Here is the setup:
One of my clients has been receiving complaints from customers that they receive the following PayPal error message when placing their order:

"10413: The totals of the cart item amounts do not match order amounts"

The client is using XC 5.2.9, and hosted X-Payments, with PayPal PayFlow Pro and iframe credit card form.

The problem only occurs when using the volume discounts module, and if the customer has a discounted item in their cart. Then the order item's "price" is different than the item's "itemNetPrice". When this happens, PayPal checks the item price and qty, and totals it up to see if it matches the cart total, and it doesn't.

To fix this, I edited the class XLite\Module\CDev\XPaymentsConnector\Core\Xpayment sClient

Line #637:
I changed:

'price' => $this->roundCurrency($item->getPrice()),

to:

'price' => $this->roundCurrency($item->getItemNetPrice()),

My thinking was that this is the file that sent the cart information to X-Payments, or at least prepared that info.And rather than send the price, I wanted to send the itemNetPrice which is what the cart total was being calculated from.

What do you think of this solution? Is there a better way? Should this fix be added to the core?

Thanks,

-Mike
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote