使用带有express_checkout的nvp,Paypal购物车商品金额的总数与订单金额不匹配

时间:2015-08-24 02:57:23

标签: php paypal express-checkout nvp

这是我使用nvp和express_checkout发送给paypal的内容,但是它给我的错误与订单金额不匹配,你能帮我解决哪一个我错过或计算错误?

我已经阅读了相同问题的帖子,但仍然不知道如何从他们建议的答案中修复我的。提前谢谢。

Array
(
    [METHOD] => SetExpressCheckout
    [SOLUTIONTYPE] => Sole
    [LANDINGPAGE] => Billing
    [ALLOWNOTE] => 0
    [PAYMENTREQUEST_0_PAYMENTACTION] => Sale
    [PAYMENTREQUEST_0_AMT] => 70.00
    [PAYMENTREQUEST_0_CURRENCYCODE] => AUD
    [PAYMENTREQUEST_0_INVNUM] => 124-1440383961
    [RETURNURL] => http://mysite.here/checkout/124/payment/return/I2Ir45QRcKkACL__OFbNrNjc8cL9Iajr0UU1LzXesWA
    [CANCELURL] => http://mysite.here/checkout/124/payment/back/I2Ir45QRcKkACL__OFbNrNjc8cL9Iajr0UU1LzXesWA
    [L_PAYMENTREQUEST_0_NAME0] => Babbling Brook - 7min Loop
    [L_PAYMENTREQUEST_0_AMT0] => 35.00
    [L_PAYMENTREQUEST_0_QTY0] => 1
    [L_PAYMENTREQUEST_0_NUMBER0] => babblingbrook-7minloop
    [L_PAYMENTREQUEST_0_NAME1] => Crackling Fire - 7min Loop
    [L_PAYMENTREQUEST_0_AMT1] => 35.00
    [L_PAYMENTREQUEST_0_QTY1] => 1
    [L_PAYMENTREQUEST_0_NUMBER1] => cracklingfire-7minloop
    [PAYMENTREQUEST_0_ITEMAMT] => 63.64
    [PAYMENTREQUEST_0_TAXAMT] => 6.36
    [NOSHIPPING] => 1
    [USER] => myusernamehere
    [PWD] => ANDPASSWORDHERE
    [SIGNATURE] => A.bIs5s0FCBv.KdshBEZ.0y1BshsBr9
    [VERSION] => 76.0
)

PayPal服务器响应:

Array
(
    [TIMESTAMP] => 2015-08-24T02:20:54Z
    [CORRELATIONID] => 7b10ddf49b4c1
    [ACK] => Failure
    [VERSION] => 76.0
    [BUILD] => 000000
    [L_ERRORCODE0] => 10413
    [L_SHORTMESSAGE0] => Transaction refused because of an invalid argument. See additional error messages for details.
    [L_LONGMESSAGE0] => The totals of the cart item amounts do not match order amounts.
    [L_SEVERITYCODE0] => Error
)

1 个答案:

答案 0 :(得分:3)

上次我玩这个时,我使用的是API版本113(现已超过一年了)。

我认为你真的只错过了每件税款。

PAYMENTREQUEST_0_ITEMAMT字段应该等于每个项目的金额(L_PAYMENTREQUEST_0_AMTn)的总和,不包括税额,乘以数量。所以你应该

'L_PAYMENTREQUEST_0_AMT0' => 31.82,
'L_PAYMENTREQUEST_0_AMT1' => 31.82,
'PAYMENTREQUEST_0_ITEMAMT' => 63.64

PAYMENTREQUEST_0_TAXAMT是每个项目的税额(L_PAYMENTREQUEST_0_TAXAMTn)乘以数量的总和。您尚未指定项目税额,但让我们说它类似于

'L_PAYMENTREQUEST_0_TAXAMT0' => 3.18,
'L_PAYMENTREQUEST_0_TAXAMT1' => 3.18,
'PAYMENTREQUEST_0_TAXAMT' => 6.36

最后,PAYMENTREQUEST_0_AMTPAYMENTREQUEST_0_ITEMAMTPAYMENTREQUEST_0_TAXAMT加上任何送货的总和

'PAYMENTREQUEST_0_AMT' => 70.00