MercadoPago with laravel 5.4 error notifications

0

I am using to integrate mercadopago a laravel a package of link and configure the button and when configuring the url of notifications in Mercadopago throws me the following error:

  

The entered URL does not respond to a correct HTTP status. You must answer   200 or 201.

The url is: link

In the route file I have:

Route::get('notifications', 'HomeController@notificationsMP');

And the method is:

public function notificationsMP(Request $r) {

   return header("HTTP/1.1 200 OK");
    return \Response::json(['HTTP/1.1 200 OK'], 200);
}

If there is another package that you recommend or how to implement mercadopago directly from your documentation (without packages), welcome it.

    
asked by Juan Pablo B 06.06.2017 в 17:39
source

2 answers

2

1- Notifications do not work on localhost
2- The route has to be POST

  

Whenever an event related to one of the resources happens   mentioned, we will send you a notification in json format using   HTTP POST to the URL that you specified.    link

3- You have to add the path in protected $ except in the Middleware VerifyCsrfToken.php

    
answered by 28.08.2017 в 19:21
1

As far as I understand this should be a post:

Route::get('notifications', 'HomeController@notificationsMP');

Then as it is a post, you will have to go to: VerifyCsrfToken.php

and add the following:

protected $except = [
        'notifications',
    ];

As it lets you do the verification correctly, but then your function is supposed to perform something and that's where I get lost.

It only works for me if you have

 return header("HTTP/1.1 200 OK");
 return \Response::json(['HTTP/1.1 200 OK'], 200);
    
answered by 27.08.2017 в 22:09