Alexander Nikolov
Alexander Nikolov

Reputation: 1979

Paypal Sandbox - notify url issue

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="[email protected]">
    <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 ?

Upvotes: 1

Views: 1175

Answers (2)

Alexander Nikolov
Alexander Nikolov

Reputation: 1979

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.

Upvotes: 0

Machavity
Machavity

Reputation: 31624

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

Upvotes: 1

Related Questions