#AlexL
1 messages ยท Page 1 of 1 (latest)
Hello! Because of the way the Internet works there's no way to ensure a certain order of Event delivery. See here for more details: https://stripe.com/docs/webhooks/best-practices#event-ordering
You need to handle out-of-order Events on your end. You can do so using several different approaches, like a queue system, or fetching the other objects you need when a certain Event arrives.
๐
ok, thank you
need to rethink ...
yea, but, let's say I have the customer.subscription.created and customer.subscription.updated at the same time
I recive first the customer.subscription.updated
and after few mls I got the customer.subscription.created whic in my case has another logic, and will overwrite the first event
You need to adjust your logic to behave differently and handle out-of-order Events.
What is the different logic for the two Events?
first of all is status of the sbscription
and Stripe gives me the status "inactive" for customer.subscription.created
and after that he changes the subscription in "active" in the customer.subscription.updated event
but if I get them in reverse
- customer.subscription.updated - status:active
- customer.subscription.created - statuc: inactive
When you get either Event you can fetch the Subscription from Stripe to determine it's current status regardless of what the payload conains.
in this case, I'll do 2 request to get the subscription
1 request on customer.subscription.updated event and imediatley another request on the customer.subscription.created
Yep.