2016-08-02 70 views
0

我正在尝试创建允许在结帐过程中使用部分付款的模块。Magento - 使用Paypal Express创建部分付款时出错

让我们用2件产品购物,​​第一件= 1000欧元,第二件= 500欧元。

用户必须支付1500欧元,但我允许分两步进行支付,第一位用户将支付1000欧元,之后他必须支付500欧元。

当尝试使用支付宝快捷支付对于这一点,我总是收到此错误:

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); 

是否有可能避免贝宝内部检查什么,比较最终金额与购物车项目金额?

回答

0

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

Paypal Request