How to create and use the Stripe's webhooks
In a previous article i've written why are important the webhooks for payments subscriptions. As Braintree, Stripe is a cool payments system which has webhooks and sunscriptions. We can use their webhooks to generate invoices, delete subscriptions and change the plan if the subscription is deleted.
How to create a webhook:
- Sign In here https://dashboard.stripe.com/webhooks
- Click on the button Add endpoint in the Endpoints receiving events from your account area.
- Enter the url https://yourwebsite.com/payments/stripe/guest
- Select two event types: customer.subscription.updated and customer.subscription.deleted
The event types:
- customer.subscription.updated - will notify about subscription renew.
- customer.subscription.deleted - will notify about subscription deletion.
The notifications are submitted as post data and we need to add an exception in the config.php:
$config['csrf_exclude_uris'] = array('payments/stripe/guest');
In the video below you can see how to create webhooks and how them works: