#mikemod-webhooks
1 messages ยท Page 1 of 1 (latest)
Hello Mikemod, how are you
Man, do you have some implementation of webhooks envolving the checkout/subscription flow?
I'm listening the events, but there are lot events simultaneously
Our docs spell this out but we don't have any specific implementation: https://stripe.com/docs/billing/subscriptions/webhooks
We emit a lot of related events because different business models care about different things. Ultimately it's up to you to determine which changes you care about and then listen to the events for those changes.
The biggest problem i have is there are concurrently updates to my entity
Because those events come from different places
For instance, a single payment of an Invoice will fire invoice.payment_succeeded, payment_intent.payment_succeeded and charge.succeeded.
In that situation it depends what information you want to get from the webhook event. The first one will have an Invoice object, the second a Payment Intent, etc.
Okay so you would need to understand what updates you care about and only take action on those
sometimes, my entity its not correctly updated because these events dont respect any order
that is why i ask about some implementation
to understand how i can create a correct flow with unorder events
but ok, i have new material to study
perhaps i resolve my problem
Our objects are pretty much all state machines that have specific transitions. Understanding how they transition can help you determine if your stored data entities should be updated.
Here's a good example doc https://stripe.com/docs/payments/paymentintents/lifecycle
My subscription entity is created with certain fields, perhaps it's better if I make all fields optional and let the webhooks take care of it, however, I lose consistency because errors can occur... do you understand? Can you tell me if it would be an appropriate implementation? A subscription created in my database with an optional status, or another field.
Unfortunately I cannot give advice on how you should structure your database. That is something you'll need to work out based on your requirements.
I hope the docs shared help you out
This is a good one for Subscriptions: https://stripe.com/docs/billing/subscriptions/overview
They will help
Nice!!
So, bye!
and thank you again
๐