#Val
1 messages ยท Page 1 of 1 (latest)
What are you trying to distinguish in your DB? For example: a subscription.updated event will contain pretty much the same data for both upgrades and downgrades, so what are you actually wanting to include in the DB?
Say they are on the $50/year plan and they downgrade to the $20/year plan months before their billing cycle ends.
In our DB I need to keep them on the $50/year plan so they enjoy the benefits of the plan they have paid for. And once their billing cycle renews and they pay the $20/year โ I want to mark that in our DB as well.
Is there an event that fires up only when the billing cycle renews, so I know Stripe is hitting my Webhook and not the user when they are deliberately downgrading.
Does that make sense?
Is there an event that fires up only when the billing cycle renews, so I know Stripe is hitting my Webhook and not the user when they are deliberately downgrading.
Unfortunately not. Theinvoice.createdevent tends to be the best indicator of when a Subscription is renewing, but that also will fire when an Invoice is created due to prorations or upgrades/downgrades.
Oh. I wonder how others deal with this.
I don't want to change their plan when they downgrade, since they've paid for more already โ until the billing cycle ends.
I don't want to change their plan when they downgrade, since they've paid for more already โ until the billing cycle ends.
Are you doing this already? Or are you asking how to do this?
I know how to do it โ just not sure what to look for in the events fired by Stripe to make the distinction when the user downgrades and when Stripe is renewing the billing cycle.
Could you just listen for invoice.created and compare the Price on the Event's invoice.items to the Price you have in the DB to see if it's an upgrade, downgrade, or renewal? Like, if you have Price A on the new Invoice that's created, and Price B in your database for that Subscription, you'll know it's either an upgrade or downgrade, right?