#ebenezer-owusu_webhooks

1 messages · Page 1 of 1 (latest)

potent orchidBOT
#

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

📝 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.

crystal ginkgo
#

hello! what are you passing in to constructEvent?

thorn jacinth
#

const sig = request.headers['stripe-signature'];
const endpointSecret = process.env.STRIPE_WEBHOOK_SECRET;
let event;

try 
{
    event = stripe.webhooks.constructEvent(request.body, sig, endpointSecret);
} catch (err) {
    console.log(err);
    return response.status(400).send(`Webhook Error: ${err.message}`);
}
crystal ginkgo
#

looks like you're using ExpressJS?

thorn jacinth
#

Yes

#

Just like the documentation stated

crystal ginkgo
#

If you're using ExpressJS the sequence of middleware matters. Do you have middleware that configures parsing all the requests to JSON somewhere? For example, if you have app.use(express.json()); prior to your route, this will parse the requests in all JSON, not in raw form before reaching to your webhook function.

thorn jacinth
#

ooh ok

#

Am removeing it

#

Is working now

#

Thanks

crystal ginkgo
#

you're welcome!