#polar18_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1222593095925895179
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello! Can you provide more details about the specific problem you're having and what isn't clear?
Hi! Sure thing, I'm trying to better understand what webhook event I should use for updating my own database to reflect a scheduled subscription change in Stripe. More info coming in next message
Right now, a customer can upgrade their subscription in app which adjusts our database and then stripe. I'd like to allow them to schedule a subscription update for their next billing cycle, and have been looking at the subscription schedule API.
When the next billing cycle rolls around, what webhook event should we listen for to make that database change to reflect the new subscription state?
It was unclear to me whether we would use subscription.updated or invoice.paid for that
It sounds like you might want to use both.
subscription.updated will let you know how the Subscription itself changed (when modified by the Subscription Schedule) and invoice.paid will let you know when Invoices for that Subscription get paid.
Makes sense, looking only at the recurring invoice/subscription update flow for now, I was unsure if relying on subscription.updated would cause potentially incorrect updates if the payment failed
Hi, taking over as Rubeus needs to step away. Can you add more details on what you mean by 'incorrect updates if the payment failed'? Are you seeing this happening on your end? What does an 'incorrect update' mean here?
Yes, I can definitely clarify - We have our own database that essentially tracks subscription state within our app. Right now that's synchronously kept in state when a customer changes their plan. In the subscription schedule state we'd be updating async through webhooks (at least for the recurring invoice case), so I was wondering whether using the subscription.updated event would result in an "incorrect update" on our end (NOT stripe's) where we update their subscription in our database but the change is then rolled back if the invoice payment fails.
Also seems like potentially it wouldn't matter if the subscription isn't rolled back, in which case we'd just move the customer into some sort of failed payment flow after updating their subscription in our database
I do not think that would be the case as if the payment fails, the status would be in an 'incomplete' status. I highly recommend that you look at https://docs.stripe.com/billing/subscriptions/overview#how-payments-work-subscriptions. Also, I recommend that you test the exact scenario on your end.
Alright that makes sense - thank you for the help
Happy to help!