Stripe's platform includes webhooks that will notify you when actions take place on your account. You can be notified when things changes in your Stripe dashboard.
In your Stripe Dashboard, go to the Developer section, then click on the Webhooks tab.
You should add a receiving endpoint by clicking Add Endpoint*. Fill in the public URL provided by ngrok, or any other public URL that can reach the webhook monitor.
** make sure to add http:yourwebsite.com/stripe/webhook **
Select these events
- (
customer.deleted
) - (
customer.subscription.created
) - (
customer.subscription.deleted
) - (
customer.subscription.updated
) - (
customer.updated
) - (
invoice.payment_action_required
)
- Click Signing secret Reveal
- Add this key in your .env in laravel STRIPE_WEBHOOK_SECRET=whsec_xyz
- Update a user's subscription quantity from Stripe Dashboard
- The changed quantity should be automaically updated in your DB.
- Or try deleting the customer
- customers's stripe id in your DB(user table) will vanish