找到你要的答案

Q:Paypal Sandbox - notify url issue

Q:贝宝沙盒通知URL的问题

I am developing online store application and I have difficult struggle with recieving order information to my notify url. Following this documentation I have created my paypal form:

<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>

where "myurl" is something like http://78.83.22.112. I am running my application on local apache server. Return and cancel urls are working as expected, but it seems like Paypal cannot call my notify url. I am developing my application with Laravel 4, so here is how i manage my notify url in routes.php:

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

This is my notify method:

public function notify() {

    Log::info("Notify hit");

}

Tested my notify url in the IPN simulator, the result is

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

What am I doing wrong ? Why sandbox cannot call my notify url ?

我开发的在线商店应用和我已经收到订单信息,我通知URL困难的斗争。下面的这个文件我创造我的贝宝的形式:

<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>

where "myurl" is something like http://78.83.22.112. I am running my application on local apache server. Return and cancel urls are working as expected, but it seems like Paypal cannot call my notify url. I am developing my application with Laravel 4, so here is how i manage my notify url in routes.php:

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

这是我的通知方法:

public function notify() {

    Log::info("Notify hit");

}

在IPN模拟器测试我的通知的网址,结果是

很抱歉,我们无法连接到这个网址。请确保输入正确。

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

answer1: 回答1:

It sounds like a firewall issue. Remember, cancel and return URLs are where PayPal sends you to a URL. I regularly test against internal non-routing URLs all the time. PayPal simply sends your browser where you tell it and does no validation on whether or not anyone can reach it.

IPN is a different story. PayPal's server must be able to connect to the URL you specify. In this case, you need to have port 80(http) open so outside users can connect. Microsoft has instructions on how to open a firewall port (Windows 7 but similar for 8.1, etc).

这听起来像一个防火墙问题。记住,取消并返回URL,贝宝发送你的URL。我经常测试内部的非路由URL所有的时间。贝宝只发送你的浏览器在你告诉它是否可以达到它没有验证。

IPN是一个不同的故事。贝宝的服务器必须能够连接到你指定的URL。在这种情况下,你需要打开端口80(HTTP),外部用户可以连接。微软有关于如何打开防火墙端口(Windows 7但类似于8.1等)的说明。

answer2: 回答2:

So after 3 days battle finally resolved this. Instead of typing "localhost" in my browser, I have typed my external IP - the one that I am sending to Paypal, to test my application. And my notify URL was called successfull. No idea why, but this resolved the issue.

所以经过3天的战斗终于解决了这个。而输入“localhost”在我的浏览器,我已经把我的外部IP的一个,我发送给贝宝,测试我的应用。我通知URL被称为成功。不知道为什么,但这解决了这个问题。

php  laravel  paypal  paypal-ipn  paypal-sandbox