Paypal Express结账,运费和错误

时间:2011-11-26 18:41:21

标签: payment-gateway paypal

数据我正在向paypal请求(SetExpressCheckout)

[METHOD] => SetExpressCheckout

[ENDPOINT] => https://api-3t.sandbox.paypal.com/nvp
[USER] => ***
[PWD] => ***
[SIGNATURE] => ***
[VERSION] => 84.0
[TOKEN] => 
[CURRENCYCODE] => GBP
[RETURNURL] => http://experiment.loc/
[CANCELURL] => http://experiment.loc/?action=cancel
[SHIPPINGAMT] => 2.21
[SOLUTIONTYPE] => Sole
[LANDINGPAGE] => Billing
[L_ITEMCATEGORY0] => Physical
[L_QTY0] => 4
[L_AMT0] => 2.20
[L_DESC0] => ZajÄ…czek 1
[L_NAME0] => ZajÄ…czek 1
[L_CURRENCYCODE0] => GBP
[L_ITEMCATEGORY1] => Physical
[L_QTY1] => 1
[L_AMT1] => 3.20
[L_DESC1] => ZajÄ…czek 2
[L_NAME1] => ZajÄ…czek 2
[L_CURRENCYCODE1] => GBP
[PAYMENTREQUEST_PAYMENTACTION] => Sale
[PAYMENTREQUEST_ITEMAMT] => 12
[PAYMENTREQUEST_AMT] => 14.21
[AMT] => 14.21

但是我一直都会收到错误:

[TIMESTAMP] => 2011-11-26T18:37:33Z
[CORRELATIONID] => 465d809d95153
[ACK] => Failure
[VERSION] => 84.0
[BUILD] => 2271164
[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 :(得分:5)

[PAYMENTREQUEST_PAYMENTACTION] => Sale
[PAYMENTREQUEST_ITEMAMT] => 12
[PAYMENTREQUEST_AMT] => 14.21

应该是:

[PAYMENTREQUEST_0_PAYMENTACTION] => Sale
[PAYMENTREQUEST_0_ITEMAMT] => 12
[PAYMENTREQUEST_0_AMT] => 14.21

此外,您的金额不会累加。您设置的最大值为14.21,但所有内容仅为7.41

L_AMTm(实际应该是L_PAYMENTREQUEST_0_AMTm)是特定于项目的。 PAYMENTREQUEST_0_ITEMAMT是al项的小计 PAYMENTREQUEST_0_AMT应该是加在一起的所有内容的总和。

E.g。

[SOLUTIONTYPE] => Sole
[LANDINGPAGE] => Billing
[L_PAYMENTREQUEST_0_ITEMCATEGORY0] => Physical
[L_PAYMENTREQUEST_0_QTY0] => 4
[L_PAYMENTREQUEST_0_AMT0] => 2.20
[L_PAYMENTREQUEST_0_DESC0] => ZajÄ…czek 1
[L_PAYMENTREQUEST_0_NAME0] => ZajÄ…czek 1
[L_PAYMENTREQUEST_0_CURRENCYCODE0] => GBP
[L_PAYMENTREQUEST_0_ITEMCATEGORY1] => Physical
[L_PAYMENTREQUEST_0_QTY1] => 1
[L_PAYMENTREQUEST_0_AMT1] => 3.20
[L_PAYMENTREQUEST_0_DESC1] => ZajÄ…czek 2
[L_PAYMENTREQUEST_0_NAME1] => ZajÄ…czek 2
[L_PAYMENTREQUEST_0_CURRENCYCODE1] => GBP
[PAYMENTREQUEST_0_PAYMENTACTION] => Sale
[PAYMENTREQUEST_0_SHIPPINGAMT] => 2.21
[PAYMENTREQUEST_0_ITEMAMT] => 5.40
[PAYMENTREQUEST_0_AMT] => 7.61

official PayPal example

&L_PAYMENTREQUEST_0_NAME0=10% Decaf Kona Blend Coffee  
&L_PAYMENTREQUEST_0_NUMBER0=623083  
&L_PAYMENTREQUEST_0_DESC0=Size: 8.8-oz 
&L_PAYMENTREQUEST_0_AMT0=9.95  
&L_PAYMENTREQUEST_0_QTY0=2  
&L_PAYMENTREQUEST_0_NAME1=Coffee Filter bags  
&L_PAYMENTREQUEST_0_NUMBER1=623084  
&L_PAYMENTREQUEST_0_DESC1=Size: Two 24-piece boxes  
&L_PAYMENTREQUEST_0_AMT1=39.70  
&L_PAYMENTREQUEST_0_QTY1=2  
&PAYMENTREQUEST_0_ITEMAMT=99.30  
&PAYMENTREQUEST_0_TAXAMT=2.58  
&PAYMENTREQUEST_0_SHIPPINGAMT=3.00  
&PAYMENTREQUEST_0_HANDLINGAMT=2.99  
&PAYMENTREQUEST_0_SHIPDISCAMT=-3.00  
&PAYMENTREQUEST_0_INSURANCEAMT=1.00  
&PAYMENTREQUEST_0_AMT=105.87  
&PAYMENTREQUEST_0_CURRENCYCODE=USD