php - Paypal Sandbox - 通知 url 问题

标签 php laravel paypal paypal-ipn paypal-sandbox

我正在开发在线商店应用程序,但我很难将订单信息接收到我的通知网址。正在关注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 服务器上运行我的应用程序。 返回和取消 url 按预期工作,但 Paypal 似乎无法调用我的通知 url。我正在使用 Laravel 4 开发我的应用程序,所以这里是我如何在 routes.php 中管理我的通知 url:

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

这是我的通知方法:

public function notify() {

    Log::info("Notify hit");

}

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

We're sorry, we could not connect to this URL. Please make sure it was entered correctly.

我做错了什么?为什么沙盒无法调用我的通知 url?

最佳答案

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

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

关于php - Paypal Sandbox - 通知 url 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30002298/

相关文章:

php - 按产品选项值过滤产品(Mysql查询)

java - Paypal 重定向 URL 要求在已经登录时登录

paypal - paypal 开发者账户必须要有真实的银行账户吗?

php - 查找 MySQL 查询不工作的原因

php - 在 PHP 中排序时 Mysql 字段值被截断

php - 尽管我已将其关闭,但仍在打开安全模式

php - 在其他模型中访问 CodeIgniter 模型

Laravel 5.6 不会登录到 Slack

php - 构建数据库模式 Laravel4 与 Symfony2

paypal-adaptive-payments - 从快速结账更新为自适应结账