If they are later creating a subscription, like you have showed
$user->subscription('monthly')
->quantity($qty)
->trialFor($trail_ends_at)
->create($token);
why are you calling the trialFor() method there again?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am playing around with Cashier. A user can sign up without a credit card, for a 30 day free trial. I am manually setting the trial_ends_at date in the db when the user signs up. Later on when they choose a subscription, I am creating it like this:
$user->subscription('monthly')
->quantity($qty)
->trialFor($trail_ends_at)
->create($token);
This works great, except for when the trial date has expired. I get an error:
Stripe_InvalidRequestError in ApiRequestor.php line 147:
Invalid timestamp: must be an integer Unix timestamp in the future.
So my only solution is to manually check if the trial has expired and have 2 different create user subscription functions. Is there any way around this?
Please or to participate in this conversation.