php – PayPal Express Checkout总是显示用户“此事务已过期”页面,但没有API错误

前端之家收集整理的这篇文章主要介绍了php – PayPal Express Checkout总是显示用户“此事务已过期”页面,但没有API错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试用PayPal的Express Checkout设置一个简单的支付顺序.我的SetExpressCheckout调用似乎工作正常,我得到ACK =成功和令牌.当我使用该令牌将用户重定向到PayPal时,它总是向他们显示一个屏幕:

This transaction has expired. Please return to the recipient’s website
to complete your transaction using their regular checkout flow.

Your session has ended

We’re sorry,but your session has ended. Your account hasn’t been
charged. Please go back to the merchant’s site and check out again
with PayPal.

只是为了澄清,我没有收到SetExpressCheckout API调用的任何错误代码,但是标记总是似乎已过期.我尝试重定向到废话令牌,但是会生成不同的页面.看来我正在收到一个有效的令牌并正确地重定向到它,但它始终在1-2秒内过期.

示例请求的详细信息:

我在最初的SetExpressCheckout请求中发送什么

Array
(
    [PAYMENTACTION] => Sale
    [useraction] => commit
    [RETURNURL] => xxxx
    [CANCELURL] => xxxxx
    [PAYMENTREQUEST_0_AMT] => 49.00
    [PAYMENTREQUEST_0_SHIPPINGAMT] => 0
    [PAYMENTREQUEST_0_CURRENCYCODE] => USD
    [PAYMENTREQUEST_0_ITEMAMT] => 49.00
    [L_PAYMENTREQUEST_0_NAME0] => xxxxx
    [L_PAYMENTREQUEST_0_DESC0] => xxxxx
    [L_PAYMENTREQUEST_0_NUMBER0] => xxxxx
    [L_PAYMENTREQUEST_0_AMT0] => 49
    [L_PAYMENTREQUEST_0_QTY0] => 1
    [METHOD] => SetExpressCheckout
    [VERSION] => 74.0
    [USER] => xxxxx
    [PWD] => xxxxx
    [SIGNATURE] => xxxxx
)

关于请求的Curl_getinfo:

Array
(
    [url] => https://api-3t.sandBox.paypal.com/nvp
    [content_type] => text/plain; charset=utf-8
    [http_code] => 200
    [header_size] => 255
    [request_size] => 798
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 1.139
    [namelookup_time] => 0
    [connect_time] => 0.187
    [pretransfer_time] => 0.64
    [size_upload] => 660
    [size_download] => 136
    [speed_download] => 119
    [speed_upload] => 579
    [download_content_length] => 136
    [upload_content_length] => 660
    [starttransfer_time] => 1.139
    [redirect_time] => 0
    [certinfo] => Array
        (
        )

    [primary_ip] => 23.4.59.42
    [primary_port] => 443
    [local_ip] => 192.168.0.102
    [local_port] => 63049
    [redirect_url] => 
)

通过curl从PayPal中获取回报:

Array
(
    [TOKEN] => EC-59031295261754641
    [TIMESTAMP] => 2014-01-20T10:12:27Z
    [CORRELATIONID] => 84d3d68cbd574
    [ACK] => Success
    [VERSION] => 74.0
    [BUILD] => 9285531
)

然后,我将用户重定向到该令牌的相关URL(使用令牌urlencoded),在这种情况下:

https://www.paypal.com/webscr?cmd=_express-checkout&useraction=commit&token=EC-59031295261754641

这一切对我来说似乎都很好,但是当我重定向到该URL时,它总是显示“事务已过期的屏幕”.

有人会指出我在做错什么吗?

问题是它是在沙盒模式,并应该重定向

https://www.sandBox.paypal.com/webscr?cmd=_express-checkout\u0026amp;useraction=commit\u0026amp;token=

而不是上面显示的URL.

显示Express Checkout integration guide的第36页.

原文链接:https://www.f2er.com/php/132262.html

猜你在找的PHP相关文章