#obo_api

1 messages ¡ Page 1 of 1 (latest)

twilit valleyBOT
#

👋 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/1354172021990232165

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

timber stirrup
#

For more info, this was last month's previousAttributes:

{
    "current_period_end": 1740509544,
    "current_period_start": 1737831144,
    "latest_invoice": "in_1QlETvEUqHBlqQXGcXop4rp1"
  }
#

The current month's can be seen here: evt_1R6caXEUqHBlqQXGmx5mY9u2

Sorry, the text is too long, I couldn't upload it to discord

#

We previously used this webhook to tell when a customer changed their susbcription item so we could hit on that, and my code checked if previousAttributes.items.data was empty, we would know that it was just a typical monthly subscription period renewal. Now it seems that all of the data for the subscription items is sent under previousAttributes.items.data because the

         "current_period_start": 1740509544,```
values were updated
upbeat sapphire
#

Hello
I'm not aware of the recent change.
Do you have an event from the previous month that shows the difference?

timber stirrup
#

yes absolutely, same customer / subscription as well

#

this is last month: evt_1QwTFdEUqHBlqQXGS8kwkd2K

#

if you compare the two here, you'll see the only item being changed in the previousAttributes.items.data array is the current_period_end and current_period_start values

upbeat sapphire
#

Is this happening with all of your subscriptions or just one?

timber stirrup
#

all of them as far as I can tell

#

March 20 seems to be when the change occurred

upbeat sapphire
#

Did you change your webhook endpoint API version recently?

timber stirrup
#

really I just need a surefire way to know the difference between:

"this customer.subscription.updated event is the result of a subscription change" (this tells us to change our internal db to reflect the new subscription)

And

"this customer.subscription.updated was the result of the monthly subscription just renewing" (basically do nothing here)

timber stirrup
upbeat sapphire
#

Hmm not sure if we have logging for that but let me see.

But taking a step back, you can look at the underlying invoice and it's billing reason to know if this event was for a subscription update or renewal

timber stirrup
#

is there a corresponding way to do this for the "customer.subscription.updated" event?

#

ideally i'd like to change as little as possible here

#

to minimize code chaos, etc

upbeat sapphire
#

There's nothing on the subscription event unfortuantely.

timber stirrup
#

I see, is there anything else you could think of that we could hit on here?

#

or I guess also let me know if you're able to see anything in the logs about API version

#

it says our API version is: 2018-09-06

#

which also matches what we have coded in our DB

upbeat sapphire
#

Yeah
I don't mean the API version on the account but on the webhook endpoint. I do see the endpoint was updated recently but I can't see what update was made

#

I see, is there anything else you could think of that we could hit on here?
Looking at the invoice's billing reason is the recommended way here

timber stirrup
#

"I do see the endpoint was updated recently but I can't see what update was made" do you have a date of change for that update?

#

the last update I'm seeing on my end is Dec 26, 2023

twilit valleyBOT
slow brook
#

Hi, taking over as my teammate needs to step away. Let me catch up.

timber stirrup
#

sounds good, let me know if you have any questions.

slow brook
#

From further looking, it appears to be a change that will stick and not an accident. I'm sorry communications were not sent.

timber stirrup
#

I see, are you able elaborate on the larger logic behind that?

Historically speaking we've relied on the "previousAttributes" section of webhooks to contain only things that are actually changing.

I can understand the item being included in that section if the current_period_end / current_period_start values are changing, but it seems odd that all of the values are being included, even if they aren't changing

#

I'm mainly concerned if this is a one off thing, or if we can basically never trust the previousAttributes section again (of any webhook)