Skip to content
Advertisement

Stripe, subscription without trial days

I created a plan with a billing period by month and a free trial of 30 days.

But on some cases, I would like not to offer the free trial.

So I create a Stripe Checkout Session with these options:

$session = StripeCheckoutSession::create([
'customer_email' => 'email@email.com',
'payment_method_types' => ['card'],
'subscription_data' => [
    'items' => [[
        'plan' => $planId,
    ]],
    'trial_period_days' => false,
],
'success_url' => 'localhost/stripe-sucess/',
'cancel_url' => 'localhost/stripe-cancel/',
]);

But in the webhooks checkout.session.completed I see all the time "trial_period_days": 30, I don’t see any change when using the option trial_period_days.

Yet on https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data there is specified:

subscription_data.trial_from_plan optional Indicates if a plan’s trial_period_days should be applied to the subscription. Setting trial_end on subscription_data is preferred. Defaults to false.

How to remove the free trial days of a plan?

NOTE

The best is to create a plan without trial days and set the trial days with subscription_data.trial_period_days.

Advertisement

Answer

To avoid the Plan’s default trial period, you’d set subscription_data.trial_from_plan: false.

https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data-trial_from_plan

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement