#dick-flair_best-practices
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/1316824458438381602
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- dick-flair_best-practices, 2 days ago, 15 messages
- dick-flair_webhooks, 2 days ago, 21 messages
- dick-flair_best-practices, 2 days ago, 32 messages
Hi there
Hi. I am currently trying to find a webhook event that will allow me to update the record in my DB to update the subscription ID. In my DB, I have a subscriptionId saved but there are times where this may be populated with the sub schedule ID (if I manually create a subscription on stripe that starts in the future, I get given the subscription schedule ID). My goal is, when this sub schedule starts, I want to update the subscriptionId saved in my DB which is currently the sub schedule ID to be the actual subscription ID
Unless there's a way to get the subscription Id from the get go for the subscription schedule? Is that possible?
There doesn't seem to be a subscription_schedule.started or an equivalent
Ah gotcha
You're right, there's no Subscription ID when you create a Schedule to start a Subscription in the future
You can still listen for customer.subscription.created then retrieve the Subscription and expand schedule: https://docs.stripe.com/api/subscriptions/object#subscription_object-schedule
If there's a value for Schedule that matches the value in your DB, you can then replace the DB value with the ID of the newly-created Subscription
Yeah, that seems like the closest thing I can use. While I have you, I don't really want the hook to be firing all the time if a customer subscription is created, is there a way to kind of limit this to my specific scenario? Or would I just have to rely on whether schedule is set and if anything matches that in my db?
Gotcha, no, there's no way to filter event sending on our end other than by event type
Which means you'll receive customer.subscription.created for every brand-new Subscription, regardless of whether or not it was created via a Schedule
Yeah, thought so. Well, I guess I'd only really be querying my DB if schedule is set and that's only set if a subscription was created via a subscription schedule right? So if I was to create a subscription that's on going right now, that schedule property would be blank. Is that right?
Correct, it would be null if you're calling the Subscriptions endpoint directly to create a Subscription
Great. I think I can work with this. Appreciate the help and sanity checks ๐
Sure thing!