【问题标题】:Paypal Sandbox - notify url issuePaypal Sandbox - 通知 url 问题
【发布时间】:2015-07-12 04:42:08
【问题描述】:

我正在开发在线商店应用程序,我很难将订单信息接收到我的通知网址。关注this documentation 我已经创建了我的paypal 表单:

<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
  <fieldset>
    <input id="buy" name="submit" type="submit" class="btn btn-primary" value="Buy" id="">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="test-facilitator@gmail.com">
    <input type="hidden" name="item_name" value="My online store">
    <input type="hidden" name="currency_code" value="EUR">
    <input type="hidden" name="amount" data-bind="value: amount"> 
    <input type="hidden" name="notify_url" value="myurl/notify">
    <input type="hidden" name="return" value="myurl/return">
    <input type="hidden" name="cancel_return" value="myurl/cancel">
 </fieldset>
</form>

其中“myurl”类似于http://78.83.22.112。我在本地 apache 服务器上运行我的应用程序。 返回和取消网址按预期工作,但似乎 Paypal 无法调用我的通知网址。我正在使用 Laravel 4 开发我的应用程序,所以这是我在 routes.php 中管理通知 url 的方式:

Route::post('/notify', 'CartController@notify');

这是我的通知方法:

public function notify() {

    Log::info("Notify hit");

}

在IPN模拟器中测试了我的notify url,结果是

很抱歉,我们无法连接到此 URL。请确保输入正确。

我做错了什么?为什么沙盒不能调用我的通知网址?

【问题讨论】:

    标签: php laravel paypal paypal-ipn paypal-sandbox


    【解决方案1】:

    听起来像是防火墙问题。请记住,取消和返回 URL 是 PayPal 将 发送到 URL 的地方。我一直定期针对内部非路由 URL 进行测试。 PayPal 只是将您的浏览器发送到您告诉它的位置,并且不会验证是否有人可以访问它。

    IPN 是另一回事。 PayPal 的服务器必须能够连接到您指定的 URL。在这种情况下,您需要打开端口 80(http),以便外部用户可以连接。微软有instructions on how to open a firewall port(Windows 7 但类似 8.1 等)。

    【讨论】:

    • 我使用的是 Windows 7 和畅通的端口 80 - 没有任何变化。也许不是这样,或者我做错了什么..
    • 您在使用住宅路由器吗?您还必须打开该端口并将其转发到您的计算机。
    • 不确定住宅路由器是什么意思,我使用的是 PON 设备。很高兴知道我的应用程序绝对可以从其他机器访问,我正在从我的办公室访问它。但无法通过paypal访问。
    • sanbox 是否可以不接受 notify_url 的 IP?也许它只能是域名?只是在黑暗中击中..
    • 网络地址转换。如果你有一个无线路由器,它有 99% 的机会为你做这个防火墙工作。 IPN 应该适用于任何有效的互联网地址,甚至是 IP。
    【解决方案2】:

    所以经过 3 天的战斗终于解决了这个问题。我没有在浏览器中输入“localhost”,而是输入了我的外部 IP - 我发送到 Paypal 的那个,以测试我的应用程序。我的通知 URL 被成功调用。不知道为什么,但这解决了问题。

    【讨论】:

      猜你喜欢
      • 2011-02-21
      • 2013-04-06
      • 2016-11-01
      • 2014-08-18
      • 1970-01-01
      • 2012-10-30
      • 2015-12-30
      • 2014-06-07
      相关资源
      最近更新 更多