magento2: Duplicated extre fees on PayPal Express
Preconditions
- Magento 2.1.7 / 2.2.5 (tested on both)
- Working PayPal Express account
Steps to reproduce
- Create a new module which adds a new row to quote totals
<section name="quote">
<group name="totals">
<item name="rush_handling" instance="Qsolutions\AdvanceCheckout\Model\Total\Quote\Handling" sort_order="150"/>
</group>
</section>
- Increase order total with custom value, lets say 10
[...]
public function collect(
\Magento\Quote\Model\Quote $quote,
\Magento\Quote\Api\Data\ShippingAssignmentInterface $shippingAssignment,
\Magento\Quote\Model\Quote\Address\Total $total
)
{
$items = $shippingAssignment->getItems();
if (!count($items)) {
return $this;
}
parent::collect($quote, $shippingAssignment, $total);
$rushHandling = 10.00;
$total->setGrandTotal($total->getGrandTotal() + $rushHandling);
$total->setBaseGrandTotal($total->getBaseGrandTotal() + $rushHandling);
$this->_checkoutSession->setIsCalculated(true);
return $this;
}
[...]
Expected result
- User can checkout! (from checkout process and cart page)
- Extra amount added to entire order, visible both backend and frontend
- PayPal Express has no issues with order processing
Actual result
- Cannot checkout!
- When trying to checkout (paypal express debug on) I see in the logs that final order amount has +20.00 value the final request to paypal (should be + 10.00)
- PayPal error: PayPal gateway has rejected request. The totals of the cart item amounts do not match order amounts (#10413: Transaction refused because of an invalid argument. See additional error messages for details).
I’ve seen in the logs (by debugging) that PayPal calls collectTotals method twice during checkout. Other native payment extensions don’t to that - they only call collectTotals method once.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (12 by maintainers)
Hi @qsolutions-pl , thank you for your report. We’ve acknowledged the issue and added to our backlog.