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

fawad.nb's avatar

Laravel cashier expiry date

I subscribed a user to a stripe plan using Laravel cashier. The stripe fields in users DB table are updated and a record is also saved in subscriptions table. How can I get the remaining days to expire a plan, or the expiry date itself?

0 likes
3 replies
confm's avatar

You can use

{{ Auth::user()->subscription('main')->ends_at->format('dS M Y') }}
fawad.nb's avatar

Thanks @confm , but the ends_at has null if the subscription is not expired or canceled. As in the docs, they said: "When a subscription is canceled, Cashier will automatically set the ends_at column in your database. This column is used to know when the subscribed method should begin returning false." https://laravel.com/docs/5.3/billing#cancelling-subscriptions What I want to know is how many days are left for the subscription to expire if it is not expired yet.

enriqg9's avatar
Auth::user()->subscription('main')->asStripeSubscription()->current_period_end
2 likes

Please or to participate in this conversation.