How can I know if a Stripe trial subscription has ended without a webhook?

Viewed 293

I am creating a Stripe customer and a subscription with a 7 day trial:


    const stripeCustomer = await stripe.customers.create({
        email: req.body.email
    });

    await stripe.subscriptions.create({
        customer: stripeCustomer.id,
        items: [{
            price: process.env['STRIPE_PRICE_ID']
        }],
        trial_period_days: 7
    })

When I check the status, it shows as trialing. After the trial ends, if I retrieve the subscription, it give a status of active. But that's not accurate because the customer didn't pay for the subscription yet.

What I want is a status that tells me that the trial has ended but that the customer has not paid yet so that I can direct the customer to the Stripe Portal when they sign in. I know there's a webhook that I can listen to, but I'd rather not worry about it at the exact moment that the trial ends. Instead, I want to deal with it when the customer signs in next.

1 Answers
Related