#AlexL

1 messages ยท Page 1 of 1 (latest)

next shuttleBOT
honest dew
iron canopy
#

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.

honest dew
#

๐Ÿ™„

#

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

iron canopy
#

You need to adjust your logic to behave differently and handle out-of-order Events.

#

What is the different logic for the two Events?

honest dew
#

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

#
  1. customer.subscription.updated - status:active
#
  1. customer.subscription.created - statuc: inactive
next shuttleBOT
iron canopy
#

When you get either Event you can fetch the Subscription from Stripe to determine it's current status regardless of what the payload conains.

honest dew
#

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

iron canopy
#

Yep.

honest dew
#

๐Ÿ˜ฆ

#

ok