#Kervin-webhook
1 messages · Page 1 of 1 (latest)
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?
So you are listening to webhook events, but are getting 404 errors? Are you using the Stripe CLI to listen to webhooks?
Can you double check that your local server is running and that you provided the correct URL in the Stripe CLI?
yes
Can you show me the 404 error you mentioned?
HTTP 404 status code indicates that the server cannot find the requested URL. So there must be issues with the URLs you provided.
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?
The subscription object has a current_period_start and current_period_end fields
https://stripe.com/docs/api/subscriptions/object
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?
That's not how webhooks work.
I recommend you to try this interactive tutorial to build your webhook: https://stripe.com/docs/webhooks/quickstart
yes I saw that article
but I am going to get the current_period_start from webhook
my idea is wrong?
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.
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
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?
I created this webhook
in this case can I use that url on the client side( frontend part)?
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.
okay
yes, it's an error your server is returning to us