#danial-subscription-trialend
1 messages ยท Page 1 of 1 (latest)
danial-subscription-trialend
can you give me the request id req_123 for that specific request you are looking at?
is it safe to give here ?
yes
Okay so your code is passing trial_end: "1674845831" for that request. That timestamp maps to 2023-01-27 2023 18:57:11 UTC but the request you made was at 2023-01-27 2023 18:57:13 UTC so 2 seconds after that timestamp
You can not pass a timestamp in the past for trial_end
thats true. But I dont understand same thing when I do on production does not throw error. It must be something with my local setup timestamp
but anyways, Thanks for this help ๐
ah yeah a common problem is if your local laptop's clock is running a bit behind
so you think you have a trial that ends in 5 minutes, but for us that time is already past
ahaaan. Exactly. Hahahahaha
so it just is whole request taking time of 2 seconds to complete, or something like that. we cannot match the clocks exactly in these cases
right?
I mean it doesn't make sense to pass trial_end to like this current timestamp or a second later. What are you really trying to do?
I am just not passing trial. Just using laravel cashier and when I add -newSubscription()->trialDays(0)
Like I dont want trial days. So I think laravel is triying to put the same datetime when the request is made to try to end the trial and then the clock doesnt sync
I mean Cashier must be passing trial_end and you need to figure out a way to tell it not to do that
yeah
what happens if you don't pass trialDays(0)?
but it does not happen on server computer staging or production. only locally
oh then it works
just problems with local computer time when laravel does Carbon::now()->adDays(0)
From Laravel cashier documentation:
/**
* Specify the number of days of the trial.
*
* @param int $trialDays
* @return $this
*/
public function trialDays($trialDays)
{
$this->trialExpires = Carbon::now()->addDays($trialDays);
return $this;
}
aanyhow, works on server
Awesome!
Why does it only happen on local btw. Any idea? Same reaosn? I'm getting nerd at it. Sorry :p
your computer locally has a different time than the computer your code run on in production
Ok ๐