#Arkham-webhook-testing
1 messages · Page 1 of 1 (latest)
Hi there 👋 it looks like your server returned a 405 status when it received the test webhook event.
It's hard for us to say why that happened.
How should I proceed?
You'll need to look at your processing logic to see if there is a case where it is explicitly returning a 405, and if it's not then you'll need to take a look at your environment to try determining why that response was sent.
That's a different event from the test event that you showed initially
like this we set the webhook and sent the subscribe
in this case we got the 405 error even though the subscription is success
but if I see the logs, it says that the status is ok as 200
Those statuses have nothing to do with the operations inside of Stripe, for example, a subscription creation will not fail because your webhook event handler returned an error code. For webhook events we (Stripe) are sending information to your server, and your server then responds to that letting us know whether or not it received the data. When you're seeing a 405 error that's because your server is returning a 405 to us.
well...
When I tried hitting your endpoint emulating our webhook events, I received a 405, and when I hit it via a browser I got a 304 that sent me to a login page. Is that URL properly configured for POST calls within your Vercel environment?
What is the endpoint you're trying to use? In the webhook endpoint that's set to capncovers.com/api/webhooks but when you tried to ping locally the address didn't contain /api.
yes
Well it seems like something in your environment is refusing to accept POST calls to that endpoint. Unfortunately we don't have insight into the operation of your server, other than the errors that it returns to us, so there isn't much guidance we can provide and you'll be best suited to troubleshoot why it's behaving this way.
Sure
I was using the ngrok url for webhook, in this case I got the 404 error
like this
do you think what the issue is?
404 usually indicates that a page isn't found. You should double check that the address is correct, and that the address is accessible.
http://f8c4-104-223-87-11.ngrok.io
you mean this address?
Yup
Again, those are two different addresses. The top ends in /dashboard and the webhook endpoint is pointing to an address that ends in /webhook.
then in the real address(site url), webhook url has to be existed?
like this?
I created the webhook url like site one
but in this case I got the 404
what is wrong on the webhook setting?
That URL should not return a webpage, it should consume the webhook event and send a 200 code back to Stripe https://stripe.com/docs/webhooks
This is an example of what the code for an endpoint can look like https://stripe.com/docs/webhooks#webhook-endpoint-integration
let me check
in case i check the webhook on the local, which secret endpoint should I use?
As in you are using the stripe listen CLI command?
In that case you would use the secret that the CLI prints when you start the listen command
yes
I got the webhook
if I use this code, I got the errors
what is the reason?
in this case the webhook is working
What is the error you are seeing?
in this case 405 or 404 error
in this case it works
You are seeing your code get hit and it is still returning a 404 or 405?
yes
So what exactly is the flow when it is in your code?
Does constructEvent return successfully?
no
one a sec
one a sec
That sounds like your code is still not being reached
Because your code does not return a 405 error, it returns a 400 if it runs in to an error
Can you send me the event ID (evt_123) from your screenshot?
for this the website is not active, so I was getting the 405 error
It sounds like you need to troubleshoot your server configuration
If the webhooks messages aren't even getting to your code, that needs to be addressed first
let me check again
also one questioin
I got the webhook and I am going to use it on the client side
on the UI part, how to do in order to get the subscription object?
also how can I fix this this error?
Let's start with the webhook error - that means your signature verification is failing because something is not matching up. This could be that you're using the wrong endpoint secret, or you're accidentally modifying the raw body of the request
Are you testing with the Stripe CLI?
Does the endpoint secret you're using match what's in the dashboard?
in where can I find it?
You should be able to find it when you click on the webhook endpoint
Yes, you want to make sure that matches
If the secret key matches then it's likely something to do with your middleware modifying the raw body. Are you using express?
You'll want to take a look at https://github.com/stripe/stripe-node/issues/341#issuecomment-818708675 and some of the other solutions suggested there
same error
There's a lot of different solutions given there - so I'd really suggest you take a look at a variety of them and see what works. If you're sure the endpoint secret is correct, then the issue is almost certainly with the raw body
working now
I got the webhook and I am going to use it on the client side
on the UI part, how to do in order to get the subscription object?
I set in order to get the response data from webhook
but the data is not wanted one
Are you saying you're trying to get the events from your webhook and send them client-side?
yes
also when send the subscritpion, webhook status is 200 , but when I got the response, its status is 400
That's not how it works - a better option would be to call out to a different endpoint on your server to check for something more specific. Like if you want to check the status of the subscription you'd retrieve the subscription from stripe or your database
You can just retrieve the subscription through the api https://stripe.com/docs/api/subscriptions/retrieve
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
That would be the subscription Id you're trying to retrieve....
You need to take a step back and think through what exactly you're trying to do and read through our documentation.
If the Subscription ID isn't something you have client-side you need to look at what other information you have available