Magento - 使用Paypal Express创建部分付款时出错

时间:2016-08-02 10:34:30

标签: magento magento-1.9 paypal

我试图在结帐过程中创建一个允许部分付款的模块。

让我们购买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在内部检查,将最终金额与购物车项目金额进行比较?

1 个答案:

答案 0 :(得分:0)

为了不将单个项目发送到Paypal API请求,后端有一个名为Transfer Cart Line Items的选项。如果设置为NO,我们不会将每个购物车项目添加到该请求中。

Paypal Request