ExpressCheckout IPN 无效响应状态 403 [英] ExpressCheckout IPN Invalid response status 403

查看:44
本文介绍了ExpressCheckout IPN 无效响应状态 403的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 PayPal IPN Listener 类,该类已经运行了好几个月,但最近(没有任何代码更改)我收到了一个奇怪的问题.

I am using PayPal IPN Listener class which was working great for months, but recently (without any code changes) I received a weird issue.

验证即时付款通知的以下代码抛出异常:无效响应状态:403

The following code which validates the Instant Payment Notification throws an Exception: Invalid response status: 403

$listener = new IpnListener();
$listener->use_sandbox = PAYPAL_SANDBOX;

try {
    $listener->requirePostMethod();
    $verified = $listener->processIpn();
} catch (Exception $e) {
    error_log('Process IPN failed: ' . $e->getMessage() . " [".$_SERVER['REMOTE_ADDR']."] \n" . $listener->getResponse());
    exit(0);
}

getResponse() 方法为我提供了以下信息:

The getResponse() method gives me this information:

HTTP/1.1 403 Forbidden
Server: AkamaiGHost
Mime-Version: 1.0
Content-Type: text/html
Content-Length: 284
Expires: Fri, 19 Sep 2014 08:06:58 GMT
Date: Fri, 19 Sep 2014 08:06:58 GMT
Connection: close
Strict-Transport-Security: max-age=63072000

<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>

You don't have permission to access "http://www.paypal.com/cgi-bin/webscr" on this server.<P>
Reference #18.682d1402.1411114018.180f58
</BODY>
</HTML>

我使用 Angelleye 库 设置了 PayPal ExpressCheckout API 调用.这不是最新版本,但到目前为止运行良好.

I set the PayPal ExpressCheckout API calls with Angelleye library. It's not the most up-to-date version, but it was working just fine so far.

我正在生成 Express Checkout 付款链接并将其放置在 HTML 中.用户将通过链接转到 PayPal(实时和沙盒工作方式相同),付款并成功返回我的谢谢"页面.已收到付款,但 IPN 失败.

I am generating the link for Express Checkout payment and place it in the HTML. The user is going to PayPal (live and sandbox work the same) through the link, pays and successfully return to my "Thank you" page. The payment is received, but the IPN is failing.

提前致谢!

推荐答案

在与 PayPal 技术支持交谈后,终于找到了解决方案.这是他们已经更改并正在努力修复的问题,但要使其再次工作,您只需发送带有 Curl 请求的用户代理"HTTP 标头,例如:

Finally found the fix for this after speaking with PayPal Technical Support. It was an issue with something they have changed and are working to fix but to get it to work again you simply have to send a "User-Agent" HTTP Header with the Curl request, so something like:

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close', 'User-Agent: company-name'));

至于User-Agent"应该设置为什么,它只需要至少 5 个字符,可能是您的公司名称,如示例所示,但不是必须的.

As for what the "User-Agent" should be set as, it just needs to be at least 5 characters, probably your company name as the example shows but it doesn't have to be.

技术支持代理还向我指出:https://ppmts.custhelp.com/app/answers/detail/a_id/92 如果上述修复不起作用,但它对我有用.

The Technical Support agent also pointed me to: https://ppmts.custhelp.com/app/answers/detail/a_id/92 if the above fix does not work, but it did for me.

Paypal IPN 验证拒绝访问

这篇关于ExpressCheckout IPN 无效响应状态 403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆