#mr-stinky-pants_webhooks
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1304543557075468360
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello, thanks for the info. Can you tell me more about where you are getting stuck? Are you getting an error about a signature verification mismatch when trying to construct the event? Or something else?
yes sorry it the dashboard its giving error 405
i cant see how to get some sort of response back from the endpoint to i know what the error is?
Gotcha, if you are seeing a 405 in the CLI, that is because your local server is returning an error when it tries to process that event. So the way to see the error would be to resend the event and place a breakpoint endpoint's code to step through what is happening
A common cause for this is that our constructEvent method expects the raw request body that we sent you but a lot of frameworks do some processing on that body before it gets to your code. I see there is this stack overflow on getting the raw body in next.js if that helps https://stackoverflow.com/questions/69968460/nextjs-stripe-webhook-raw-body
cheers ill check it
but shouldnt the try catch then allow the end point to send a message back to stripe?
Yes it does and you can typically see it in your event logs https://dashboard.stripe.com/test/events
One thing that unfortunately gets in the way of this is our CLI endpoints and it looks like you are using one at the moment. The CLI itself responds with a 200 so it usually just looks like a success in our logs even if your local server errored out in some way
i dont see why in the logs the response is like a stripe payment intent?
shouldnt it be the response i send from the endpoint
Are you talking about on this page or somewhere else? https://dashboard.stripe.com/test/events/evt_3QIylZJKY8YXH2zh1xE0VTcI
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
It should show the request body, which is what we sent to your endpoint, and then the "HTTP status code" and "Response body" which are what we got back from your server
i was looking at https://dashboard.stripe.com/test/logs
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Oh and it looks like we should actually show what your local server sent back.
That is the API request that you made to us, so in that case the request body is your request to stripe and the response is what we sent you back, which would be a payment intent object in this case
yes i see it now
Webhook Error: Webhook payload must be provided as a string or a Buffer
Ah there we go, so I think the SO that I linked to should help. It shows how to get the raw event body as a buffer
theres a link on there that seems more useful https://github.com/BastidaNicolas/nextauth-prisma-stripe
you dont need any packages i dont think
just this
const buf = await request.text();
event = stripe.webhooks.constructEvent(buf, sig, endpointSecret);
Nice! that is way easier
yes got there i think getting past that stage anyway
so its events not logs i need to be looing at
Yep yep, events are what Stripe sends you, logs are when you make requests to stripe
Of course, have a good weekend!