1

我在使用经典的 PayPal NVP API 时遇到问题。它抱怨总数不匹配,我真的不知道为什么会这样。

The NVP name-value pairs which are sent to Paypal
array(19) {
  ["METHOD"]=>
  string(18) "SetExpressCheckout"
  ["AMT"]=>
  string(5) "48.00"
  ["MAXAMT"]=>
  string(5) "48.00"
  ["RETURNURL"]=>
  string(40) "http://vikingchallenge/site/payPalReturn"
  ["CANCELURL"]=>
  string(40) "http://vikingchallenge/site/payPalCancel"
  ["REQCONFIRMSHIPPING"]=>
  string(1) "0"
  ["NOSHIPPING"]=>
  string(1) "1"
  ["LOCALECODE"]=>
  string(2) "GB"
  ["PAYMENTREQUEST_0_AMT"]=>
  string(5) "48.00"
  ["PAYMENTREQUEST_0_CURRENCYCODE"]=>
  string(3) "GBP"
  ["PAYMENTREQUEST_0_ITEMAMT"]=>
  string(2) "40"
  ["PAYMENTREQUEST_0_TAXAMT"]=>
  string(4) "8.00"
  ["PAYMENTREQUEST_0_DESC"]=>
  string(6) "Adults"
  ["PAYMENTREQUEST_0_ALLOWEDPAYMENTMETHOD"]=>
  string(18) "InstantPaymentOnly"
  ["L_PAYMENTREQUEST_0_NAME0"]=>
  string(6) "Adults"
  ["L_PAYMENTREQUEST_0_DESC0"]=>
  string(6) "Adults"
  ["L_PAYMENTREQUEST_0_AMT0"]=>
  string(2) "20"
  ["L_PAYMENTREQUEST_0_QTY0"]=>
  string(1) "2"
  ["L_PAYMENTREQUEST_0_TAXAMT0"]=>
  string(4) "8.00"
}

The response from Paypal
array(9) {
  ["TIMESTAMP"]=>
  string(20) "2013-07-15T14:54:32Z"
  ["CORRELATIONID"]=>
  string(13) "f64e080a80db6"
  ["ACK"]=>
  string(7) "Failure"
  ["VERSION"]=>
  string(4) "92.0"
  ["BUILD"]=>
  string(7) "6868861"
  ["L_ERRORCODE0"]=>
  string(5) "10413"
  ["L_SHORTMESSAGE0"]=>
  string(94) "Transaction refused because of an invalid argument. See additional error messages for details."
  ["L_LONGMESSAGE0"]=>
  string(63) "The totals of the cart item amounts do not match order amounts."
  ["L_SEVERITYCODE0"]=>
  string(5) "Error"
}
4

1 回答 1

1

将 L_PAYMENTREQUEST_0_TAXAMT0 更改为 4.00,因为您有 qty=2 的此行项目。

METHOD=SetExpressCheckout
CANCELURL=http://vikingchallenge/site/payPalCancel
RETURNURL=http://vikingchallenge/site/payPalReturn
MAXAMT=48.00
REQCONFIRMSHIPPING=0
NOSHIPPING=1
LOCALECODE=GB
PAYMENTREQUEST_0_AMT=48.00
PAYMENTREQUEST_0_CURRENCYCODE=GBP
PAYMENTREQUEST_0_PAYMENTACTION=SALE
PAYMENTREQUEST_0_ITEMAMT=40
PAYMENTREQUEST_0_TAXAMT=8.00
PAYMENTREQUEST_0_DESC=Adults
PAYMENTREQUEST_0_ALLOWEDPAYMENTMETHOD=InstantPaymentOnly
L_PAYMENTREQUEST_0_NAME0=Adults
L_PAYMENTREQUEST_0_DESC0=Adults
L_PAYMENTREQUEST_0_AMT0=20
L_PAYMENTREQUEST_0_TAXAMT0=4.00
L_PAYMENTREQUEST_0_QTY0=2
于 2013-07-15T22:27:09.323 回答