PayPal - 快速结帐 - 购物车项目金额的总和与订单金额不匹配 (10413)


Paypal - ExpressCheckout - The totals of the cart item amounts do not match order amounts (10413)

我正在使用以下内容并一遍又一遍地收到相同的错误;请注意:AMT和ITEMAMT = $paymentAmount。

出于对$deity的热爱,我无法理解为什么金额不匹配。

$grandtotal = 0;
for ($i = 0;$i < $numItems;$i++) {
    $subtotal = $theBasket[$i]['item_preco'] * $theBasket[$i]['item_qty'];
    $grandtotal += $subtotal;
    echo $subtotal.'<br>';
    $mCq .= '&L_PAYMENTREQUEST_0_NAME'.$i.'='.htmlentities($theBasket[$i]['item_nome']).
        '&L_PAYMENTREQUEST_0_AMT'.$i.'='.$theBasket[$i]['item_preco'].
        '&L_PAYMENTREQUEST_0_QTY'.$i.'='.$theBasket[$i]['item_qty'];
}

for 循环返回以下内容:

&L_PAYMENTREQUEST_0_NAME0=哈姆萨手镯戒指

&L_PAYMENTREQUEST_0_AMT0=9

&L_PAYMENTREQUEST_0_QTY0=1

$paymentAmount = number_format($grandtotal,2);
        $nvpstr = $mCq;
        $nvpstr .= '&PAYMENTREQUEST_0_AMT='.$paymentAmount;
        $nvpstr .= '&PAYMENTREQUEST_0_ITEMAMT='.$paymentAmount;
        $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_PAYMENTACTION=" . $paymentType;
        $nvpstr = $nvpstr . "&RETURNURL=" . $returnURL;
        $nvpstr = $nvpstr . "&CANCELURL=" . $cancelURL;
        $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_CURRENCYCODE=" . $currencyCodeType;

嗯。我修好了。问题是:它说它有的错误不是"断开链接"的错误。

而不是这是 10413(总金额无论如何)这是一个"字段缺失"的简单情况;在这种情况下,'&L_PAYMENTREQUEST_0_NUMBER'.$i.'='.$theBasket[$i]['ct_item_id']. '&L_PAYMENTREQUEST_0_DESC'.$i.'=descricao'.那些缺少的人