#AdrianWebiny
1 messages ยท Page 1 of 1 (latest)
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
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 inprevious_attributesthecurrent_period_endandcurrent_period_startchanged andlatest_invoicechanged, and that Invoice if you retrieve it will have abilling_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
awesome @solemn mango , on first look, these look good
thank you, will try it now, and come back to you with the result ๐
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 ! ๐ป
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
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