Subscribd exposes a dedicated webhook controller for each gateway. When a payment provider sends an event to your application, the controller verifies the signature, records the event for idempotency tracking, and fires the corresponding Laravel event — all before your application code runs.
Webhook endpoint URLs
Point each gateway’s webhook configuration at the appropriate URL for your application:
| Gateway | Endpoint URL |
|---|
| Stripe | https://your-app.com/subscribd/webhook/stripe |
| PayPal | https://your-app.com/subscribd/webhook/paypal |
| Braintree | https://your-app.com/subscribd/webhook/braintree |
These routes are registered automatically. You do not need to add anything to routes/web.php.
Idempotent processing
Every incoming event is stored with its gateway-issued event ID. Before processing, Subscribd checks whether that ID has already been handled. If it has, the event is silently discarded. This means duplicate deliveries — common during gateway retries or network issues — are always safe no-ops.
Listen to billing events
Register listeners in your EventServiceProvider to react to billing lifecycle changes. All seven events live in Pixelworxio\Subscribd\Events\:
use Pixelworxio\Subscribd\Events\SubscriptionCreated;
use Pixelworxio\Subscribd\Events\SubscriptionUpdated;
use Pixelworxio\Subscribd\Events\SubscriptionCanceled;
use Pixelworxio\Subscribd\Events\InvoiceCreated;
use Pixelworxio\Subscribd\Events\PaymentSucceeded;
use Pixelworxio\Subscribd\Events\PaymentFailed;
use Pixelworxio\Subscribd\Events\TrialEnding;
Each event exposes the relevant model as a typed property:
| Event | Available properties |
|---|
SubscriptionCreated | $event->subscription |
SubscriptionUpdated | $event->subscription |
SubscriptionCanceled | $event->subscription |
InvoiceCreated | $event->invoice |
PaymentSucceeded | $event->invoice |
PaymentFailed | $event->invoice, $event->message |
TrialEnding | $event->subscription, $event->daysRemaining |
Handling a failed payment
Send the customer an email when a payment fails:
use Pixelworxio\Subscribd\Events\PaymentFailed;
Event::listen(PaymentFailed::class, function (PaymentFailed $event) {
// $event->invoice — the Invoice model
// $event->message — gateway error string
Mail::to($event->invoice->billable->billingEmail())
->send(new PaymentFailedMail($event));
});
Handling a canceled subscription
Notify the user when their subscription is canceled:
use Pixelworxio\Subscribd\Events\SubscriptionCanceled;
Event::listen(SubscriptionCanceled::class, function (SubscriptionCanceled $event) {
$event->subscription->billable->notify(new SubscriptionCanceledNotification());
});
Replay a webhook event
If a handler threw an exception or a listener was registered after an event was first delivered, you can reprocess any stored event by ID:
php artisan subscribd:webhook replay {webhook_event_id}
The command calls the handler directly, bypassing HTTP entirely, so no signature verification is performed. Look up the event ID from the admin panel or the Artisan subscription list commands.
Replaying an event re-fires all listeners for that event type. Make sure your listeners are idempotent before replaying events that trigger side effects like emails or external API calls.