How can i add trial period when update subscription plan?

545 views Asked by At

I am currently using Cashier (Stripe) to the Plan subscription. I am currently using $this->subscription->swapAndInvoice($this->selected->stripe_plan_id); like this to change the subscription plan. Here i want to know how can i add trial period (7days) when i change subscription plan? If anyone have any idea? please give your thoughts.

1

There are 1 answers

0
Nolan H On BEST ANSWER

This doesn't appear to be an optional parameter directly in the swapAndInvoice function, but you should be able to update the subscription immediately before the swap to add a trial:

$subscription->extendTrial(
  now()->addDays(7)
);

The docs say that if a trial exists, it will be preserved:

If the user is on trial, the trial period will be maintained.