2016-08-02 59 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