编程语言
首页 > 编程语言> > PHP-Paypal使用nvp和express_checkout的购物车商品总金额与订单金额不符

PHP-Paypal使用nvp和express_checkout的购物车商品总金额与订单金额不符

作者:互联网

这是我使用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
)

贝宝服务器响应:

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
)

解决方法:

我上一次玩此游戏时,我使用的是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_AMT是PAYMENTREQUEST_0_ITEMAMT和PAYMENTREQUEST_0_TAXAMT的总和

'PAYMENTREQUEST_0_AMT' => 70.00

标签:express-checkout,nvp,php,paypal
来源: https://codeday.me/bug/20191119/2039177.html