1
votes

I have a unique use case where I need to build in 14 extra days on top of a Stripe subscription plan but bill the client immediately. So if the plan is a 6 month plan, we really want to give the user 6 months and 14 days.

I originally thought I could leverage Stripe's trial feature for this, but found that the trial feature causes the billing to happen after the 14 days have passed which is not what we want.

I then tried to create plans by number of days (which is not really ideal but was worth a shot) but soon found that you cannot create a plan by days with more than 365 days (a year's plan with our model being 365+14).

I'm now thinking about creating one 14 day temp plan, subscribing a user to that, charging them and then after the 14 days, switching the user's plan over to a real 6 (or 12) month plan. This just feels overly complicated with a lot of overhead for wanting to simply add in extra days. I haven't seen anything anywhere in the docs that addresses this.

I should mention that I intend to use Laravel Cashier with this project and that I will also need to offer multiple plans per subscription.

UPDATE:

I just discovered that you can alter the billing cycle after a subscription has been billed using a trial. Which would mean that I should be able to create a customer subscription with multiple plans for say 6 months and then immediately after, create a 14 day trial on that subscription. If I go this route, it looks like I would need to set prorate to false and this might do the trick.

I still need to know if this will achieve the desired effect as well as work with both cashier and multiple plans.

1

1 Answers

2
votes

I'm not sure why this got down-voted as it is a valid question given the limitations of Cashier along with the unconventional use case.

For anyone who might have more custom needs when using Stripe & Laravel Cashier and comes across this question:

I've since had time to explore this and found that Laravel Cashier cannot handle editing the subscription after the fact. There is no update feature there. Only the basic abilities to change/cancel plans. This didn't work for my needs.

What I ended up doing was using Cashier for creating Invoices as well as creating the subscription. Immediately after I am able to use the Stripe API directly to edit that subscription. By adding a trial_end with a date set 14 days after this subscription's current_period_end I can force the billing date of the next invoice to where I need it to be.

So for example, when a user subscribes to a 1 year plan, my update code would look like the following:

    $current = Carbon::now();
    $BillCycleDate = $current->addDays(379)->timestamp; 

    $edit_subscription = \Stripe\Subscription::retrieve($subscription->stripe_id);
    $edit_subscription->trial_end = $BillCycleDate; 
    $edit_subscription->prorate = false;
    $edit_subscription->save();

Also, I'm not sure if its a bug in the Stripe API, but simply specifying a trial_end date 14 days out on a subscription update causes the invoice to be rebilled right after that trial end date - despite the plan's interval being a year.