A delegation interface for handling PayPal webhook events
This module is a PayPal webhook event handling delegation interface, a subclass can handle one or
more event and an event can be handled by one or more subclass
By default the environment is set to sandbox
Vulcan\PayPalWebhook\PayPalWebhook:
environment: sandbox
oauth_sandbox_clientid: ".."
oauth_sandbox_secretid: ".."
oauth_live_clientid: ".."
oauth_live_secretid: ".."
webhook_sandbox_id: ".."
webhook_live_id: ".."
You can also use test keys and the webhook simulator will work fine with this module
WARNING: While this module is in sandbox mode, events will NOT be verified!
<?php
use Vulcan\PayPalWebhook\Handlers\PayPalEventHandler;
class CustomerDisputeHandler extends PayPalEventHandler
{
private static $events = [
'CUSTOMER.DISPUTE.CREATED'
];
public static function handle($event, array $data)
{
// $event is the string identifier of the event
return "Do something here";
}
}
Any subclass of PayPalEventHandler
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.
Easily introduce new event handling functionality without needing to touch any files relating to other event handling classes.
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem