#daniqwlkd
1 messages ยท Page 1 of 1 (latest)
- I don't believe all are, no. What are you trying to do exactly?
- There's the created timestamp: https://stripe.com/docs/api/events/object#event_object-created
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Hey, thanks!
Re 1): I have this issue where I receive webhooks for subscriptions, and sometimes I get them out-of-order, ex:
- customer.subscription.updated (status:active)
- customer.subscription.created (status:incomplete)
Recommended coding your webhook integration so you don't rely on event order
We don't guarantee order of delivery of events
Of course, afaik it's at-least-once semantics, no linearizability.
Would it be a horrible idea to just retrieve the latest subscription object from the API whenever I get a Webhook? ๐
Depends on the event type and how often you're getting them
We have api rate limits
it's for customer.subscription.create / customer.subscription.update / customer.subscription.delete
of course this is useless if the subscription api is eventually consistent (could run into the same issue w/ out-of-order events, except i'd get the outdated data from an api, not the event)
If you retrieve the subscription via our api you should get accurate data back
at retrieval
ah
that'd be neat
what i'm afraid of with the created timestamp is that it doesn't include nanos, so if the events happen on the same second I'm cooked
Can you explain your situation a bit more? Why do you need these events in order? Often with subscriptions people get by on just listening to invoice.paid, invoice.payment_failed, and customer.subscription.deleted
I'm running a simple subscription service, 14 days free trial, pretty basic. I'd like to keep track of subscriptions basically and keep Stripe and my system in sync.
Currently, I'm listening for customer.subscription.deleted, customer.subscription.updated, customer.subscription.created to sync the "status" of the subscription (using the object from the event).
Is there a particular reason you can't get by on the 3 events I mentioned?
They have most data people need
this is literally what i'm doing
it works just fine, except when I receive the events out-of-order, so I'll likely opt for retrieving the latest state from the API (as opposed from the event's payload), now that I know it's consistent
btw โ first time, surprisingly nice docs for how complicated this could be.
up to you on what you want to do. I just personally prefer the approach i linked
cheers, thanks for the help
no problem
i'll do pretty much this, except get the sub from the API