#CowLover24
1 messages ยท Page 1 of 1 (latest)
Let me check to make sure I understand. The subscriptions in stripe is active and customer payments are succeeding, but for some reason your own system are recording some other status?
Yes, that is mostly accurate. It is strange because our customers put in their payment info and everything went successfully. They made their first payment and their subscription was active. And in our database, it also showed that their subscription was active. Now, their status has been switched to incomplete though. Sorry if this is confusing it is confusing to me as well. I just do not know how this happened. The only way our records change are through Stripe webhooks, so it had to of been changed as a result of that. don't hesitate to ask if more clarification is needed or any other details.
When I say now their subscription has been switched. I mean like a week or two after their first payment
Do you have an example subscription ID i can look at?
I can only guess as to why your system would make such a change if we're not seeing any changes ourselves
You will likely need to work backwards to determine what is causing your subscription tracking to make these changes
Then if that's driven by something unexpected then we can dig into that
Here is an example subsription ID: sub_1MZeQlL5D7Gm20cBtbYgcqA1
This user has an active subscription on stripe, but suddenly in our records their status has been switched to incomplete. This hd to of been done through a webhook call. Not sure why tho.
There don't appears to have been any events since the initial sign up, so I've not sure why you'd have that happen
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
That's the event showing the active subscription following checkout completion
OK, i think i have an idea of what happened here
awesome!
During checkout, several events happen in quick succession, and they are likely arriving/processing out of order (this is expected and documented)
Before that updated event there is created event:
https://dashboard.stripe.com/events/evt_1MZeQqL5D7Gm20cBiyb0QZGQ
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
this has status incomplete
My records show you got these during the same clock second
that event does look a lot more similar
If you're tracking the status of these from events and using both the created and updated event, you want to make sure you're getting the latest status
So instead of directly logging the status from the event in your system, instead retrieve the subscription by its ID, and use the status on the response you get
this will guarantee you have the latest version of that object
So here is our webhooks to handle the updated vs created event they both are essentially doing the same thing. Both assigning the stripeId object you saw above. Are we doing something wrong here? are you saying the .created call is overriding the .updated call? like its happening before?
Do you have an material to look at for this?
Sorry lots of questions will give you a sec to take it in and respond.
Nothing explicitly wrong, aside from perhaps assuming you'll get the updated event after the created event, which may not be true
SO you either want to retrieve the latest version of the object instead of using the event payload, or you can skip the db update when handling the created event if the subscription record already exists (from the updated event)
Thank you for this.
I have one last thing.
I believe this issue just came about though. This event was on Feb 9th when the user paid and they have been very active on the since. Not until today did this issue come up. Do you know why this could be?
Hello ๐
Taking over as synthrider needs to step away
Hello thank you!
this seems like a long running thread ๐
Would you mind giving me a quick summary of the ask while I catch up?
Yes, sorry about the length
The latest question I asked was just about why this issue cane up recently. My understanding is we have the data from the event.created event instead of event.updated. I believe that is pretty certain at this point. My confusion tho is that this just came up. This was an event from Feb 9th so I am not sure why now it is an issue.
Also, synthrider recommended that I retrieve the latest version of the object instead using the event payload. If you had insight into this method instead that would be great.
Stripe does not guarantee the order of delivery for this events, https://stripe.com/docs/webhooks/best-practices#event-ordering.
From looking at the recommendation, you should retrieve the subscription, https://stripe.com/docs/api/subscriptions/retrieve and get the latest status from the response here.
I will look into this. Hopefully, with all of this additional knowledge, I will be able to figure it out. Thank you for all the help.
Absolutely!