#mad-trial-will-end-event

1 messages ยท Page 1 of 1 (latest)

analog zodiac
#

Hey! Can you share an example event ID? evt_xxx

dry harness
#

Hey!
here's the request ID req_LD7vawYYVUIwnF for my request to end the trial (before the trial_end date)

#

and here's the webhook event id:

2021-12-17 09:25:06   --> customer.subscription.trial_will_end [evt_1K7cgXBVFeaV0FZKzZBu9aXV]
analog zodiac
#

Thanks, will take a look!

dry harness
#

Many thanks @analog zodiac ๐Ÿ˜‰

analog zodiac
#

Hmm. Yeah, can see the trial_end is updated in your API call, but not reflected in that event

dry harness
#

any idea why ?

#

I mean why customer.subscription.trial_will_end is fired out of that 3 days to trial_end range ?

analog zodiac
#

And it's sent at the same timestamp as the customer.subscription.trial_will_end (2021-12-17 09:25:05)

#

So you probably need to code a little defensively in your webhook handler to prevent this

dry harness
#

i get it, so maybe delaying like 2seconds, and asking back for that subscription state to see if active or trialing ?

analog zodiac
#

That's one option I guess, seems a little expensive

#

Trying to think of another

dry harness
#

is there a possible calculation between date to see if it's in that 3 days period

analog zodiac
#

Yeah, I guess that would work

#

You can use the trial_end timestamp and compare it to Date.now()

#

And see if it's actually within the timeframe you want

dry harness
#

yay this seems a better solution, thank you for your time ๐Ÿ™‚

#

stripe timestamps are UTC ?

analog zodiac
#

Yep!

dry harness
#

implemented and tested, all good ! many thanks ๐Ÿ‘

analog zodiac
#

Nice, np!