DoExpressCheckoutPayment

DoExpressCheckoutPayment

我开始使用PayPal,而我的第一项工作是在我们的网站上对其进行调试。

实际上,当我们转到订单末尾时,它可以正常工作,但是我们在日志中得到了堆栈:"Invalid token (#10410: Invalid Token)"
在调用doExpressCheckoutPayment时会发生这种情况,并且似乎没有令牌也没有付款人,因此引发了错误。所有其他信息似乎都已正确填写。

这是调用doExpressCheckoutPayment的调试结果:

[DoExpressCheckoutPayment] => Array
(
    [TOKEN] =>
    [PAYERID] =>
    [PAYMENTACTION] => Sale
    [AMT] => 4.16
    [CURRENCYCODE] => EUR
    [BUTTONSOURCE] => Varien_Cart_EC_FR
    [NOTIFYURL] => *
    [RETURNFMFDETAILS] => 1
    [ITEMAMT] => 3.36
    [TAXAMT] => 0.80
    [SHIPPINGAMT] => 0.00
    [L_NUMBER0] => *
    [L_NAME0] => *
    [L_QTY0] => 1
    [L_AMT0] => 4.10
    [L_NUMBER1] =>
    [L_NAME1] => Discount
    [L_QTY1] => 1
    [L_AMT1] => -0.74
    [BUSINESS] =>
    [EMAIL] => *
    [FIRSTNAME] => *
    [LASTNAME] => *
    [MIDDLENAME] =>
    [SALUTATION] =>
    [SUFFIX] =>
    [COUNTRYCODE] => *
    [STATE] => *
    [CITY] => *
    [STREET] => *
    [ZIP] => *
    [PHONENUM] => *
    [SHIPTOCOUNTRYCODE] => *
    [SHIPTOSTATE] => *
    [SHIPTOCITY] => *
    [SHIPTOSTREET] => *
    [SHIPTOZIP] => *
    [SHIPTOPHONENUM] => *
    [SHIPTOSTREET2] =>
    [STREET2] =>
    [SHIPTONAME] => *
    [ADDROVERRIDE] => 1
    [METHOD] => DoExpressCheckoutPayment
    [VERSION] => 72.0
    [USER] => ****
    [PWD] => ****
    [SIGNATURE] => ****
)

[response] => Array
(
    [TIMESTAMP] => 2013-03-07T15:01:45Z
    [CORRELATIONID] => 64adbc2375f59
    [ACK] => Failure
    [VERSION] => 72.0
    [BUILD] => 5331358
    [L_ERRORCODE0] => 10410
    [L_SHORTMESSAGE0] => Invalid token
    [L_LONGMESSAGE0] => Invalid token.
    [L_SEVERITYCODE0] => Error
)


问题在于,在调用此方法之后,便立即调用setExpressCheckout并成功完成,因此正确放置了顺序。

这是调用setExpressCheckout时的成功响应:

[response] => Array
(
    [TOKEN] => EC-5UG654898R029060W
    [TIMESTAMP] => 2013-03-07T15:01:48Z
    [CORRELATIONID] => 348b58c6200c1
    [ACK] => Success
    [VERSION] => 72.0
    [BUILD] => 5331358
)


我不明白为什么在执行doExpressCheckoutPayment时会引发故障,而在执行setExpressCheckout时却未检测到错误并且反而接受了销售。

方法调用顺序是否有问题?我的意思是,不应在setExpressCheckout之前调用doExpressCheckoutPayment吗?

我们在使用PayPal时遇到了另一个问题,我希望解决这个问题可以解决另一个问题。

非常感谢您的帮助!

塞布

最佳答案

SetExpressCheckout应该首先发生-您获得的令牌是重定向客户浏览器所使用的令牌,当他们返回时,他们将在URL中包含令牌,也就是说,当您需要查看时,可以使用getExpressCheckoutDetails他们的收货地址和相关信息,最后您运行doExpressCheckoutPayment提交交易。

重申一下:从setEC获取有效令牌,在重定向中使用此令牌,将此令牌重新附加到客户返回的RETURNURL上,并在随后的任何getEC中引用此令牌,并且doEC通话。

07-28 07:10