#beastboy_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/1242135106806747158
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello
Hi
You can either track the current product in your own database from the time the Subscription is created, or you can retrieve the Subscription to see it at the moment the UI is visited using: https://docs.stripe.com/api/subscriptions/retrieve
I'd recommend storing this on your side though
In terms of how will you know when the Product changes, you would listen for a customer.subscription.updated Event
And that would indicate the product change
sorry but to clarify, because the admins can choose when the product will udpate, I'll be using subscription schedules
I am using subscription schedules to schedule the product updating on the subscription
Yep that's fine
The customer.subscription.updated Event will fire when the Sub actually updates
I see, I'm just a little worried about using that event. How can I ensure that I'll only be updating our data internally for the product changing. Because I know this webhook gets called a lot for various reasons (subscription canceling, a subscription schedule being created for it... etc)
Is there a parameter I can look at?
Yeah you would check the past_attributes
And compare that to what is currently in the Event
My recommendation would be to test this all out using Test Clocks: https://docs.stripe.com/billing/testing/test-clocks
That is the best way to see how this all works
I
I'm not following - past attributes is not on the customer.subscription.updated event here: evt_1PIXtcDyFtOu3ZuTE6A500eF
oh it's previous attributes
I see got it
One last hting - what's the difference between the the 'plan' key and 'price' key on the object? Is there one I should be using when checking the new 'price' it got updated to?
Oops sorry
yes previous_attributes
You should only pay attention to the price key
plan is legacy
And just there for backward compatibility
You can ignore it
cool thank you!
Sure thing