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

Mohamm6d's avatar

Laravel Cashier - Renew, cancel or resume subscriptions

Hi

Recently, I have integrated Cashier (Stripe) with my laravel platform. Everything goes well so far. User can select a plan, enter their card details and subscribe to that plan (with a trial period)

But if they cancel their subscription, if Stripe cannot charge them after trial ends, How I can handle this part in Laravel? apparently, there is no sync function between Stripe and Laravel

I made a test account, subscribed with real card to a plan and before first month ends, I cancelled the plan. After end_time of subscription, user was still in premium plan and however, customer was updated on Stripe, but not in Laravel

My main question is how I can have integration (or sync function) between Stripe and Laravel for when customer renew the plan, cancel or resume the plan.

Thank you in advance

0 likes
5 replies
m7vm7v's avatar

I think most of that is handled automatically for you. Usually when you cancel a subscription laravel stores an end date in the database. So for example if I subscribe today for a 30 days and cancel tomorrow then I will be having 29 more days to use my sub (thats the default situation of course).

Stripe uses webhook so if the defaults or the edge cases are not suitable for you then checkout https://github.com/spatie/laravel-stripe-webhooks

Hope that helps.

Mohamm6d's avatar

Thank you for your help.

Actually, the system works just like you said. But when I cancelled my subscription. even after end_date, the subscription was active in the database. I think my problem is when I call cancel() or cancelNow() functions, it cancels the Stripe but not update the subscription table on the database.

m7vm7v's avatar

If you have the cancelled_at date correctly stored in the database then use it for checking if its active or not.

martinbean's avatar

Actually, the system works just like you said. But when I cancelled my subscription. even after end_date, the subscription was active in the database. I think my problem is when I call cancel() or cancelNow() functions, it cancels the Stripe but not update the subscription table on the database.

@mohamm6d I think your problem is, you’ve not fully read the Cashier documentation.

Cashier includes a webhook handler to, well, handle webhooks sent by Stripe. When a subscription is cancelled in Stripe, Stripe will send a webhook saying this. You need to set up a handler for these webhooks to then update the subscription in your database when it’s updating in Stripe.

Have a good read through the entire Cashier docs before rolling out a subscription-based application: https://laravel.com/docs/7.x/billing

Mohamm6d's avatar

@martinbean @m7vm7v Thank you both. However, I think I already added the webhook for Stripe but will test it again with a new configuration. :)

Please or to participate in this conversation.