#Mr.Medi
1 messages · Page 1 of 1 (latest)
Can you share the subscription id?
Yes
sub_1NOJAKJKetCvGTPaUMjWthVh
its a subscription of one day, yesterday i canceled and in my local db the field ends_at have the value 2023-06-30 11:37:36, but the status remain in canceled and not in expired
I have a webhook which should be the responsible of updating it
Do you have some idea about what it can be? If you need more info let me know. I will appreciate some help on this
Sorry for the delay
Looking
Canceled is the expected status
If you set a sub to cancel at the end of the period that's the status that it will go in
should not be changed with the webhoook?
my goal is to check if the suscription is expired, is there any feasible way to do that?
or should i compare dates?
What do you mean by expired?
Yeah, yesterday the user suscribed to my suscriptoin of one day. He canceled it, so today should not have access to the paid content
I want to check if the user is able to view the paid content or not in a feasible and escalable way
I though that if the user cancels it, the webhook updates the status to expired or something to check it
Hi 👋
I"m stepping in as @lunar snow needs to go soon. Are you saying you did not receive any webhook events about the user cancelling the subscripton? Can you provide the subscription ID?
Yes, sub_1NOJAKJKetCvGTPaUMjWthVh
Okay, here is the event we generated https://dashboard.stripe.com/test/events/evt_1NOffYJKetCvGTPa9u9hD46h
This was fired today 11:39 UTC
We sent the event to the CLI as well as the integreitor.com webhook endpoint
Beyond that I can't really speak to what is normal or not
All endpoints returned a successful response
the integreitor.com is the website where i will implement it, but i didnt lauch the app yet. I will like to test it in my local server
this is all the event that I have today in my cli
and this is the object in my local db
is like is not sync
because in the frontend the status is canceled but in my db not
The event was sent to the placeholder endpionts for the CLI.
what do you mean with placeholder?
i dont see the status for that event in the cli, should it appear for that event?
No, we have internal endpoints that are for the CLI.
What I'm saying is the event was sent successfully
Ok thanks, do you have some guidance about why is not updated in my local db?
Well I don't know how you are handling receiving these events so I don't know. It's possible the listen command was not running when the event was issued. Does your system handle all event types or were you filtering on specific ones?
My cli was listening all the day...and in the output i didnt received any event
I use laravel cashier that handles it automatically
Unfortunately I can only tell you that the events left our network as a POST request and received a 200 successful response.
Thanks, just to make sure. Its my first time implementing stripe gateway, but then the cli should have received the event, right?
In general yes but the CLI is primarily for testing purposes. You should implement a dedicated webhook URL and register it. Using event forwarding via the CLI is for testing local development, not production.
Okay but for this case, where you didn't get/handle the event and you want to sync your DB. You can retrieve the event from the API. https://stripe.com/docs/api/events/retrieve
I know that doesn't help automatically catch these issues but it's another fallback approach to keeping your DB sync'd with Stripe data
I would just update your DB to whatever the Subscription is in the Event payload
Or if you have a better way to do it im open. My goal is just to check if the user have paid and the suscriptoin didnt expired to see the paid content
In the event payload is canceled
it makes sense, in my db the status is active but in ends_at field
so, to check if the user can view the paid content, I should check if the status is canceled and the ends_at is in the past? or are there more cases that should i have in mind
That is up to you and how your business model uses the Subscription object.
I will continue with that after. Thank you for your help!