我试图在结帐过程中创建一个允许部分付款的模块。
让我们购买2件商品,第一件商品= 1000欧元,第二件商品= 500欧元。
用户必须支付1500欧元,但我允许分两步支付,第一个用户将支付1000欧元,之后他将需要支付500欧元。
尝试使用Paypal Express付款时,我总是收到此错误:
PayPal gateway has rejected request.
Item total is invalid (#10426: Invalid Data).
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).
基本上,我正在做的是修改app/code/local/Mage/Paypal/Model/Express
覆盖Amount
的值:
$transaction_amount = $this->_quote->getBaseGrandTotal();
if ($this->_quote->getPartialpayment_price() > 0) {
$transaction_amount = $this->_quote->getPartialpayment_price();
}
$this->_api->setAmount($transaction_amount)
->setCurrencyCode($this->_quote->getBaseCurrencyCode())
->setInvNum($this->_quote->getReservedOrderId())
->setReturnUrl($returnUrl)
->setCancelUrl($cancelUrl)
->setSolutionType($solutionType)
->setPaymentAction($this->_config->paymentAction);
是否有可能避免Paypal在内部检查,将最终金额与购物车项目金额进行比较?