加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – PayPal Express Checkout总是显示用户“此事务已过期”页

发布时间:2020-12-13 16:32:03 所属栏目:PHP教程 来源:网络整理
导读:我正在尝试用PayPal的Express Checkout设置一个简单的支付顺序.我的SetExpressCheckout调用似乎工作正常,我得到ACK =成功和令牌.当我使用该令牌将用户重定向到PayPal时,它总是向他们显示一个屏幕: This transaction has expired. Please return to the reci
我正在尝试用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-checkoutu0026amp;useraction=commitu0026amp;token=

而不是上面显示的URL.

这显示在Express Checkout integration guide的第36页.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读