#AdrianWebiny

1 messages ยท Page 1 of 1 (latest)

royal totemBOT
paper frigate
#

this is also something I noticed

#

now I think I've added all the info I can ๐Ÿ™‚

#

so far, the only difference I've spotted in these two events is with the previous_attributes , where it's null when Stripe issues the event in the next BC

solemn mango
#

somehow differentiate between these two events?
well in the .updated call that happens when the subscription cycles, you know it's specifically a cycle because in previous_attributes the current_period_end and current_period_start changed and latest_invoice changed, and that Invoice if you retrieve it will have a billing_reason:"subscription_cycle" and a creation date matching the time of the event closely

#

so there are a few hints from that event that it's about a cycle and not an update

paper frigate
#

awesome @solemn mango , on first look, these look good

#

thank you, will try it now, and come back to you with the result ๐Ÿ™‚

paper frigate
#

alright @solemn mango , I just inspected the latest_invoice property on the 2nd customer.subscription.updated event, and found the billing_reason: "subscription_cycle" you mentioned, so I will use that to detect if an event was triggered by a sub cycle or user just did the downgrade via app UI

#

thank you @solemn mango ! ๐Ÿป

solemn mango
#

awesome!

#

but yeah

#

basically if there's an update, and in the update the change is that we changed the last_invoice pointer, and that invoice was created due to subscription_cycle, that's very strong signal that the update is about the subscription cycling

paper frigate
#

thanks!

#

BTW one final thing I just accidentally found in a SO post:

#

as we can see, when a user submits the downgrade/the event is triggered, we see there's a value in the request field

#

when it's a Stripe cycle event, it's null

solemn mango
#

yes, that can work too, but i would likely try to avoid relying on that too much

#

not for any specific reason, it just feels like something that could be more brittle compared to directly looking at the subscription API fields

paper frigate
#

sounds good @solemn mango

#

alright, that's it for me, won't bother you anymore

#

thanks again!