I'm trying to create a subscription for a user based on the last day of the month using Stripe and Laravel, and Laravel Cashier. So, I just set the trial end date for the last day of the month to stop them being billed immediately:
$user = Auth::user();
$user->trial_ends_at = Carbon::now()->lastOfMonth();
$user->save();
$user->subscription(Input::get('subscription'))->create(Input::get('stripeToken'), [
'email' => $user->email
]);
return Redirect::to('/profile');
But for some reason, Stripe and Laravel ignore this, and in my database and Stripe admin I have the trial end date set to the Stripe default (40 days from today). If I try and set it up on a Stripe account with no trial, it bills the test user immediately.
What am I doing wrong?
If I comment out the $user->subscription...
line it keeps the correct time in the DB.