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

mikebronner's avatar

Cashier Always Returns True when checking Subscription()

I'm problem going about this the wrong way, and wanted to see how others are solving this:

  • A user signs up and gets 30 days trial without having to enter credit card.
  • User should be prompted for credit card when trial expires.

I have registered the user and set them up with the respective subscription that includes a trial period as provided by the plan configured on Stripe.

However, I am unclear as to how to check if that trial is expired. I was thinking of checking Auth::user()->subscribed() and Auth::user()->onTrial(), but they don't seem to change if I update the trial_end_date to test what happens.

Here's my registration code:

        $user->subscription('premium-monthly')->create(null, [
            'email' => $user->email,
            'metadata' => [
                'firstName' => $user->first_name,
                'lastName' => $user->last_name,
            ]
        ]);

And then I'm checking in my master view:

if (Auth::check()) {
        if (! Auth::user()->subscribed()) {
// show payment form
        }
}
0 likes
3 replies
mikebronner's avatar
mikebronner
OP
Best Answer
Level 16

I think I figured it out:

  • I need to sign them up, then deactivate stripe.
  • I need to check if they are expired in views.

Registration:

        $user->subscription('premium-monthly')->create(null, [
            'email' => $user->email,
            'metadata' => [
                'firstName' => $user->first_name,
                'lastName' => $user->last_name,
            ]
        ]);
        $user->setStripeIsActive(false);

Check in master view:

if (Auth::check()) {
    if (Auth::user()->expired()) {
    // show billing form
    }
}

Please or to participate in this conversation.