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

jpeterson579's avatar

Run listener on SubscriptionCancelled Event

Does anyone know how to run an event when a subscription is actually cancelled and past the subscription ends_at time?

I created my own event listener that runs on

laravel/spark/events/subscription/subscriptionCancelled

However I found that it is running when someone changes there plan from paid to free and does not allow for the remaining subscription time to pass.

Any thoughts on how to do this?

0 likes
3 replies
ejdelmonico's avatar

I think the problem you are running into is that the SubscriptionCancelled event uses the UpdateActiveSubscription class. The handle method saves the changes if the event is an instance of SubscriptionCancelled. In essence, it changes the plan for the user. If you look in Cashier Subscription class, you can see a cancelled, onGracePeriod and valid methods that may help you. These method are available in Subscription.php by extensions of the class.

jpeterson579's avatar

Im sorry been trying to figure this out still and very confused on how to tie this into the cashier subscription.php...

ejdelmonico's avatar

You don't really have to tie it in since Spark is built on top of Cashier. It is already there for you to use.

Please or to participate in this conversation.