#Mr.Medi

1 messages · Page 1 of 1 (latest)

graceful ginkgoBOT
lunar snow
#

Can you share the subscription id?

onyx spoke
#

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

lunar snow
#

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

onyx spoke
#

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?

lunar snow
#

What do you mean by expired?

graceful ginkgoBOT
onyx spoke
#

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

sterile glen
#

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?

onyx spoke
#

Yes, sub_1NOJAKJKetCvGTPaUMjWthVh

sterile glen
#

This was fired today 11:39 UTC

onyx spoke
#

my local webhook didnt catch it

#

is it normal?

sterile glen
#

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

onyx spoke
#

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

sterile glen
#

The event was sent to the placeholder endpionts for the CLI.

onyx spoke
#

what do you mean with placeholder?

#

i dont see the status for that event in the cli, should it appear for that event?

sterile glen
#

No, we have internal endpoints that are for the CLI.

#

What I'm saying is the event was sent successfully

onyx spoke
#

Ok thanks, do you have some guidance about why is not updated in my local db?

sterile glen
#

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?

onyx spoke
#

My cli was listening all the day...and in the output i didnt received any event

#

I use laravel cashier that handles it automatically

sterile glen
#

Unfortunately I can only tell you that the events left our network as a POST request and received a 200 successful response.

onyx spoke
#

Thanks, just to make sure. Its my first time implementing stripe gateway, but then the cli should have received the event, right?

sterile glen
#

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.

onyx spoke
#

Yes, im using it in local

#

Im just testing before launching it

sterile glen
#

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

onyx spoke
#

Perfect! What the status should be after sync?

#

past_due?

sterile glen
#

That is up to you

#

Or do you mean in Stripe?

onyx spoke
#

Yeah, in both

#

If it should be sync must be equal?

sterile glen
#

I would just update your DB to whatever the Subscription is in the Event payload

onyx spoke
#

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

sterile glen
#

That is up to you and how your business model uses the Subscription object.

onyx spoke
#

I will continue with that after. Thank you for your help!