Download the PHP package vulcandigital/silverstripe-stripewebhook without Composer
On this page you can find all versions of the php package vulcandigital/silverstripe-stripewebhook. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vulcandigital/silverstripe-stripewebhook
More information about vulcandigital/silverstripe-stripewebhook
Files in vulcandigital/silverstripe-stripewebhook
Package silverstripe-stripewebhook
Short Description A delegation interface for handling Stripe webhook events
License BSD-3-Clause
Informations about the package silverstripe-stripewebhook
silverstripe-stripewebhook
This module is a Stripe webhook event handling delegation interface, a subclass can handle one or more event and an event can be handled by one or more subclass
Requirements
- silverstripe/framework: ^4
Configuration
You can also use test keys and the webhook simulator will work fine with this module
Usage
- Install and dev/build
- Add a webhook endpoint to Stripe that points to https://yourdomain.com/stripe-webhook and ensure that it sends the events you require
- Create your functionality for your event(s):
Any subclass of StripeEventHandler
is detected and requires both the private static $events
and public static function handle($event, $data)
to be defined.
private static $events
must be defined and can be a string containing a single event identifier or an array with multiple
public static function handle($event,$data)
must be defined and should not call the parent. $data will be a \Stripe\Event
object which has the exact same hierarchy as the JSON response depicted in their examples.
Features
- All handled events are logged, along with the responses from their handlers.
- Duplicates are ignored, if Stripe sends the same event more than once it won't be processed, but the logged event will count the occurence
- All events are verified to have been sent from Stripe using your endpoint_secret you defined in the configuration above
Why?
Easily introduce new event handling functionality without needing to touch any files relating to other event handling classes.
License
Vulcan Digital Ltd