Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

MoeSaid's avatar

how to listen to the subscription model events ?

what's the way that I can listen to the subscription model using Cashier with stripe webhooks?

pretty much I want to do something whenever the user paying the second + bill, as sending notification or so.

0 likes
7 replies
MoeSaid's avatar

am just trying to come up with the logic to use and the best practices to do so.

what would you do in this situation?

Nakov's avatar

@moesaid well as the documentation says, I will follow it. Create endpoints in my project for each webhook that Stripe provides.. set the URL's on the Stripe dashboard and do whatever needs to be done in my application. For example, if a customer deleted the subscription I will revoke his/her access to my platform by setting a timestamp field when it should expire, and I will either check for that in the login, or will setup a middleware.

Same for the other webhooks, depends on the system always but I will make endpoints for those that I am interested in, and perform an action whenever necessary.

MoeSaid's avatar

@nakov the thing is not that clear for me yet, when the user subscribes and then his membership renewed automatically without user interfere, do stripe notify my server?

Nakov's avatar

@moesaid Yes, Stripe can notify you for lots of events that they provide.

So just log in to your Stripe dashboard.. You can click on the Developers link on the left side then you click on webhooks: https://imgur.com/N6EwXl2

Then you can click on the Add endpoint : https://imgur.com/Vww8SHm

Then you add your URL from your web application and the endpoint you want to accept webhooks from stripe on, and you add the events for which you want Stripe to notify you: https://imgur.com/N92i6T5.

1 like
MoeSaid's avatar

@nakov thanks for spotlighting that, working with stripe webhooks now seems to be fun,

I am a bit confused tho when it comes the stripe webhooks named as on customer.subscription.created

https://stripe.com/docs/api/events/types#event_types-customer.subscription.created

didn't find something related to renewing or so but thought about using the invoice hook as every new subscription payment done stripe make an invoice for,

what do you think is the best hook to use if I am looking for the subscription renew event (2nd, 3rd, 4th payment, etc.)

Please or to participate in this conversation.