#testanib
1 messages · Page 1 of 1 (latest)
Hey there
This is possible but will take a bit of filtering on your end.
You mostly want to use the customer.subscription.updated event here for all cases.
But, you can determine a renewal based on the previous_attributes that will be in the customer.subscription.renewal event.
is the customer.subscription.renewal event only fired when it is a renewing charge? and customer.subscription.updated only after the charge was successful?
Hmm where are you seeing customer.subscription.renewal? That isn't a webhook event we support afaik
The customer.subscription.updated event will fire any time anything changes with a Subscription object
You can see info on the different events here: https://stripe.com/docs/billing/subscriptions/webhooks#events
you mentioned it here, unless I misunderstood
Sorry, maybe I shouldn't have put renewal in backticks... I refer to a "renewal" as the natural payment that happens when a Subscription cycles.
We have no event that will just indicate a renewal.
Any time a renewal happens though a customer.subscription.updated event will fire
Which will indicate the new billing period
This event will also fire when you make other Subscription updates
However then the event will contain a lot of other info as well
I'd recommend testing this out so you can see for yourself. You can use test clocks (https://stripe.com/docs/billing/testing/test-clocks) to fast-forward time and trigger renewals.
alright thanks for the help
@astral sonnet just want to confirm the subscription updated webhook fires before the charge webhook right? thats how it seems currently from my tests
This ordering of delivery is not guaranteed, so you'll need to make sure you check the latest state of any objects if your business logic depends on those sequences:
https://stripe.com/docs/webhooks/best-practices#event-ordering
do any of the other events have the subscription previous_attributes? or do we need to query that on a successful charge instead of waiting for the subscription updated webhook