#Kervin-webhook

1 messages · Page 1 of 1 (latest)

robust salmon
#

Hi @sage fox! Could you clarify exactly what you are trying to do?

sage fox
#

thanks for your message

#

I am going to get the subscription active and end date from webhook

#

I can give them to roles for site accessing . thus when subscription end, I remove the roles

#

for now why do I get the 404 error on the webhook?

robust salmon
#

So you are listening to webhook events, but are getting 404 errors? Are you using the Stripe CLI to listen to webhooks?

sage fox
#

yes

#

it is correct, but when listen the webhook event

robust salmon
#

Can you double check that your local server is running and that you provided the correct URL in the Stripe CLI?

sage fox
#

yes

robust salmon
#

Can you show me the 404 error you mentioned?

sage fox
#

yeah

#

one a sec

#

also this

robust salmon
#

HTTP 404 status code indicates that the server cannot find the requested URL. So there must be issues with the URLs you provided.

sage fox
#

let me check again

#

btw, how can I get the subscription start and end date from webhook?

#

after clicking the subscription button, the subscription is created.

#

in this case how can I get subscription start and end date on the code?

robust salmon
sage fox
#

ok

#

can I get the current_period_start from webhook?

#

in this here

#

when I use the GET
/v1/subscriptions on the localhost, that url is localhost:3000/v1/subscriptions?

robust salmon
#

That's not how webhooks work.

sage fox
#

yes I saw that article

#

but I am going to get the current_period_start from webhook

#

my idea is wrong?

robust salmon
#

Firs,t listen to the event you are interested in, for example customer.subscription.created
Then, get the obejct from the webhook, with something like const subscription = event.data.object;
Then directly look at the values you are interested in, for example subscription.current_period_start.

#

The only URL you need is the URL of your local server (something like localhost:3000/webhook) that you pass to the Stripe CLI.

sage fox
#

ok thanks

#

also

#

I set the webhook with online url

#

but I got the 405 error after subscription

#

what does this means?

#

there?

#

if I create the webhook on the stripe dashboard, I think I can use that url o n the client side

robust salmon
#

Sorry for the delay, the 405 error means there is an error on your server.

#

if I create the webhook on the stripe dashboard, I think I can use that url o n the client side
I'm not sure to understand. What's the question exaclty?

sage fox
#

I created this webhook

#

in this case can I use that url on the client side( frontend part)?

robust salmon
#

The only place where you need to use the webhook URL is when you setup you webhook with Stripe. Then Stripe will automatically call this URL when an event is fired.

sage fox
#

okay

sage fox
#

is this server error?

blazing shale
#

yes, it's an error your server is returning to us