2

Paypal Express works fine if there's no coupon applied. If there's a coupon applied, it fails with the usual #10413 error "totals of the cart item amounts do not match order amounts".

I have a requirement to customize the discount logic so that the discounts are reflected in the unit prices and not in the standard lump sum. There is a rounding issue when the quantities are large and Paypal will reject the payment. After hacking the Paypal module code, I can send a correct AMT = ITEMAMT + SHIPPING.

However, after returning from the Paypal payment confirmation page to Magento, for some reason the error #10413 appears again because AMT is changed (not the AMT that was sent to Paypal). I am not able to figure out why or how AMT is changed.

I am using Magento community version 1.8.1.0.

  • In Mage/Paypal/Model/Api/Nvp.php, I can see that $this->getAmount() has the value of AMT but is changed, but I don't know which method is called to change the "amount". – Saul Karl Dec 15 '15 at 11:14
1

I spent 2 days but still could not find out who changed the value in AMT.

The following hack works for now. In app/code/core/Mage/Paypal/Model/Api/Nvp.php, change the method callDoExpressCheckoutPayment():

 ...
 $this->_exportLineItems($request);
 $finalTotal = $request['ITEMAMT'] + $request['SHIPPINGAMT'];
 if (sprintf('%.2F', $request['AMT']) != sprintf('%.2F', $finalTotal)) {
     $request['AMT'] = $finalTotal;
 }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.