yes it is that simple
in your method:
// Retrieve the request's body and parse it as JSON
$input = @file_get_contents("php://input");
$event_json = json_decode($input);
// Do something with $event_json
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Good evening, tonight I have a question about how to use webhooks with Laravel. I am working with a European billing platform and not Stripe or Braintree (for several reasons, but that is not the point here). This platform offers webhooks, now for example I want to do something in my application when I get the info from the billing system that a invoice has been paid. Setting up the webhook is simple: I provide a URL and the state as well as a secret key if I like.
Now my question is: how to best process the webhook in Laravel?
The easiest solution I can think of is setting up a POST route directing it to a method in a controller (which is exempt of CSRF checking). This method simply accepts the JSON received, processes it and we are done.
Is it that simple or am I missing out on something here? (I found https://github.com/mpociot/captainhook for example and was wondering why I would need such a package?)
Thanks Andreas
yes it is that simple
in your method:
// Retrieve the request's body and parse it as JSON
$input = @file_get_contents("php://input");
$event_json = json_decode($input);
// Do something with $event_json
Please or to participate in this conversation.