#beastboy_best-practices

1 messages ¡ Page 1 of 1 (latest)

indigo coralBOT
#

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

zealous socket
#

Hello

frail swan
#

Hi

zealous socket
#

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

frail swan
#

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

zealous socket
#

Yep that's fine

#

The customer.subscription.updated Event will fire when the Sub actually updates

frail swan
#

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?

zealous socket
#

Yeah you would check the past_attributes

#

And compare that to what is currently in the Event

#

That is the best way to see how this all works

frail swan
#

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?

zealous socket
#

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

frail swan
#

cool thank you!

zealous socket
#

Sure thing