#mike-mod_api

1 messages ¡ Page 1 of 1 (latest)

lilac lichenBOT
#

👋 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. Thank you for your patience!

⏱️ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime! If this thread is closed and you have another question you'll need to start a new thread.

🔗 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/1214654614771732531

📝 Have more to share? You can add more detail below, including code, screenshots, videos, etc.

neat galleon
#

Does this make any sense, or have you already dealt with a case like this?

hot sandBOT
neat galleon
quiet elk
#

Hello! I wouldn't generally expect customer.subscription.updated to trigger at all when a Subscription is created. Can you give me the ID of one of the Events in question so I can take a look? It's the ID starting with evt_.

neat galleon
#

The problem is that your events are not deterministic; it's not possible to know which execution will come first, so I can't determine the latest version of the persisted information. In my tests, customer.subscription.updated was always able to pull the recent version. When I tried to create a switch with "created" and "updated," the result was incorrect sometimes because one would overwrite the information of the other, even though it was outdated information.

#

Ok i will get

#

But I think I don't have this event because I probably am not including it, right? I have the event for subscriptions that aren't paid with a coupon, and these do trigger my event. And what's the ID of the event you're looking for?

#

But I'm sad to know that by simply adding a coupon, I need to rearrange the logic, if my assumptions are correct, because I don't know how to do this in a deterministic way addressing all scenarios.

#

Sucesfull event without coupon evt_1Or3NOCSwJ5Uw0SfvZ5TtCCg

#

evt_1Or3NOCSwJ5Uw0SfvZ5TtCCg

quiet elk
#

The best way to be deterministic is to ignore most of the payload of the Event and only use the ID to grab the current version of the object from the API.

#

Meaning, if you always only want the current version of the Customer, or the current version of the Subscription, get the ID from the Event and fetch the object from the API. Ignore the rest of the Event data.

#

Would that work for what you're trying to do?

neat galleon
#

When the events have already been triggered, have all possible mutations of the objects already been performed, or should I expect something else?

#

Yes, probably but in not conviced what event i need to listening is this case with checkout payment with coupon

#

what you suggest?

#

and the major cases

#

in not able to add trial with the same problem, i think... but i dont do a lot tests with this case

neat galleon
quiet elk
#

You can't assume that with webhooks. By their nature, and because of how the Internet works, you get them in no particular order, and some can be delayed for various reasons, or fail and get retried later. Let's go one level higher. Can you tell me more about why you want to know this information in the first place? Why are you listening for these Events?