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

mstdmstd's avatar

How to check if user is subscribed to some stripe's plan

Hello, In my Laravel 5.8 I search how to check if used is subscribed to some stripe's plan. I make subscription with stripe and I have installed

        "stripe/stripe-php": "^7.2",
        "laravel/cashier": "^10.3",

In app/User.php :

use Laravel\Cashier\Billable;
...
class User extends Authenticatable implements MustVerifyEmail
{
    use Billable;
    use Notifiable;

When I ned to subscribe to stripe's plan I make :

      $ret= $user->newSubscription('main', 'plan_ID')->create($requestData['purchaseDetails']['payment_token']);
where plan_ID is id of plan registered at stripe dashboard

Searching for checking subscribed method I found and tried:

                if( Auth::user()->subscribed( 'main', $item['stripe_plan_id'] ) ) {
                    die("-1 XXZ ===  subscribed");
                }

I tried stripe_plan_id or stripe_plan_name - but failed in both cases

Also I tried :

$user->subscriptions

but it returned empty array. In Stripe dashboard I see that logged user is subscribed to stripe_plan_id... Which way is correct ?

Thanks!

0 likes
0 replies

Please or to participate in this conversation.