#polar18_api

1 messages ¡ Page 1 of 1 (latest)

steep remnantBOT
#

👋 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.

stone burrowBOT
tulip pike
#

Hello! Can you provide more details about the specific problem you're having and what isn't clear?

umbral axle
#

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

tulip pike
#

It sounds like you might want to use both.

steep remnantBOT
tulip pike
#

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.

umbral axle
#

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

regal pelican
#

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?

umbral axle
#

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

regal pelican
umbral axle
#

Alright that makes sense - thank you for the help

regal pelican
#

Happy to help!