#lounis_webhooks

1 messages ¡ Page 1 of 1 (latest)

fickle kestrelBOT
#

👋 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/1317170079468617739

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

frosty remnant
#

Looking into this now! Can you share a payment intent ID where you expected to receive a webhook event and didn't receive it? I can use that to look up a relevant event ID.

daring pond
#

This one should have gone through: pi_3QVWzfP0nqB5m0Ff1MDr4G0e

#

I've been looking at it a bit more and I see when I log the attempts that I get this error:
Webhook Error: No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?

I declare the route like this:


  app.use('/payments/webhook', bodyParser.raw({ type: 'application/json' }));

Again, it works when forwarding to localhost but not the staging api

frosty remnant
#

Gotcha. Can you take a quick look at this doc and give some of these a try? It could be that you're using the wrong endpoint secret based on what you've shared so far but would be good to run through all of them just in case.
https://docs.stripe.com/webhooks/signature

daring pond
#

Thanks! I'll take a look right now

daring pond
#

So I've checked the page you gave me, the payload I receive seems to be the correct type, when I JSON.stringify the payload, it shows a "type" key and a "data" key which is a Buffer.
The Stripe signature seems consistent with the example provided in the doc as well which leaves only the secret..

frosty remnant
#

Just want to double check, you're not using JSON.stringify before passing the payload to the API are you? If so that would result in a failure. But yeah, based on what you're saying (local working vs staging not) key mismatch feels very likely here.

One other thing I can suggest is just trying to reduce the business logic your application is using to a bare minimum to make sure nothing could be interfering with the response body. Starting with the webhook builder here can be a good starting point to sanity check things - these should just work.
https://docs.stripe.com/webhooks/quickstart

daring pond
#

Yes I used the webhook quickstart to put it into place, I use nest to set up all the routing but I put the webhook route directly in the main.ts for just this reason (like I sent to you before). I'm really perplexed by this, I'm not even getting the logs from the webhook anymore.
Here's the event I get from the workbench for a payment I just tried:
payment_intent.succeeded: evt_3QVdkRP0nqB5m0Ff1wUHBaed

I guess I have a lot of logic in the webhook itself, should I return a 200 response before doing all of my updates?

#

Sorry for the spam but now that I'm checking the workbench, the only events logged as sent are these from yesterday:

fickle kestrelBOT
lean elm
#

Hello
Taking over here as solanum needs to step away soon.

#

Yes, you should respond to the webhook request as soon as possible and perform business logic async (after you've ack'ed Stripe's request)