I'm currently using Laravel Cashier (4.2) with Stripe. The current Stripe API version I'm using is 2014-06-17. I have tried in various ways to set the trial end date when creating a subscription. I have tried all kinds of variations of this code:
$company->trial_ends_at = Carbon::now()->addDays(14);
// Also tried this variation of the trial date
// $trialEndDateUnixTimestamp = strtotime(Carbon::parse($company->trial_ends_at));
$company->subscription('annual')
->create($creditCardToken, ['description'=>$company->company_name, 'email'=>Auth::user()->email], null);
$company->trial_ends_at = Carbon::now()->addDays(14);;
$company->save();
When I look at the request sent to Stripe, trial_end
is always null
. Any ideas are appreciated.
The official Laravel Cashier documentation states the following:
$user->subscription('monthly') ->withCoupon('code') ->create($creditCardToken);
The subscription method will automatically create the Stripe subscription, as well as update your database with Stripe customer ID and other relevant billing information. If your plan has a trial configured in Stripe, the trial end date will also automatically be set on the user record.
If your plan has a trial period that is not configured in Stripe, you must set the trial end date manually after subscribing:
$user->trial_ends_at = Carbon::now()->addDays(14);
$user->save();
The manual setting of the trial date is what seems to not be working. I tried the method outlined by the official docs, and the user is always charged right away because for some reason the trial period is not being applied.
The more I look at the documentation, the more I think it doesn't even support trial periods if it's not on the Stripe side. The key lines are: "If your plan has a trial period that is not configured in Stripe, you must set the trial end date manually after subscribing", but by that point, the subscription has already been created, and thus the charge has already been made....