Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AlighaThor's avatar

Strange thing happening with a POST callback from a payment system.

Here's the thing: I'm integrating my Laravel app with a Online Payment Service. Nothing fancy, very similar to Paypal and others. I do not post the name of the company for ethical reasons. I do not wanna create controversy outside our direct communication (mine and the company's).

So, the issue is that after the setup and integration with their front-end checkout (setup with JS), and performed the transaction to their servers, I must recieve a POST callback to my endpoint and handle the transaction according to my needs, etc, etc. The issual thing.

The problem is, that I'm not recieving any POST callback to my server. I'm recieving (supposedly) a GET callback.

So, I've defined a route like this:

Route::match(['post'], 'callback', 'PaymentController@callback');

Nothing special about this. Also the route is excluded from the VerifyCsrfToken middleware (for now):

protected $except = [  
  'api/*',  
  'callback'  
];

So, as I'm saying, I'm not receiving any POST request. The way I'm checking that is logging in disk in case the endpoint is reached:

class PaymentController extends Controller  
{  
  public function callback() 
  {  
      $data = request()->all();  
      Log::debug('Callback executed: ', $data);  
  }  
}

I'm doing that because is the only way I found due the app is hosted in a shared enviroment with CPanel, MySQL and the rest of the party, and with no access to SSH or whatever to allow me doing remote debugg. If you know other way to debug instead of logging to disk, I'm listening. :)

So, after I contacted the support of the company several times, I finally ended trying with changing my endpoint verb to GET (for curiosity). This works as expected and generates my log with the data transaction:

Route::match(['get'], 'callback', 'PaymentController@callback');

Strange, due the documentation and the Company support keeps telling me that they send the data with POST request. They even said me that in fact they couldn't send data in the body with GET requests (good point), but after checking several times with Postman and other services, my endpoint seems to be clearing listening for only POST requests. They said also (and this is suspicious to me), that they found that Laravel presents issues with this. Funny, this is the very first time that this happens to me, and I have created more than 10 Laravel apps in a year without this type of issue.

So, I'm confused. Right now it works with the weird GET endpoint. Is eather a way that Laravel or my hosting changes the type of request? I have never saw that.

How could my endpoint be listening to other verbs in some requests and not in others?

Thanks for reading!

0 likes
0 replies

Please or to participate in this conversation.