Subscribe to PHP Freaks RSS

Freek Van der Herten: Handling Stripe webhooks in a Laravel application

syndicated from www.phpdeveloper.org on October 9, 2017

Freek Van der Herten has a new post to his site showing you how to handle Stripe callbacks when integrating its webhook functionality into your application. True to form, he also created a Laravel package to make it even easier.

In the project I’m currently working on I had to integrate Stripe webhooks. Stripe has great documentation on how to handle webhooks, but it still took a fair amount of time to get the integration just right. My solution for handling webhooks is pretty generic and reusable by others. I decided to extract it to a package called laravel-stripe-webhooks, so nobody has to code this stuff up again. In this blogpost I’d like to share how the package works.

He then goes on to talk about the request validation that happens on the webhook callback and how the information can be reworked if something goes wrong. He then talks about the handling of valid requests either using a custom job or using events to trigger when a "source.chargable" event is fired.