Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

128
Views
Stripe webhooks - checking request from Stripe

I want to check if request on my endpoint is from Stripe. I can do this, I can check this but the problem is - my code after try catch blocks is not triggering.

Even if I write all this console logs in try block AFTER I assing response from Promise to event variable. All of my code AFTER event = await stripe.webhooks.constructEvent(payload, sig, endpointSecret); is not working. Also I dont have any errors...

I want to send response 200 and continue with more complicated code on server but it stops working after checking req from stripe.

    pixelRouter.post("/payments", async (req, res) => {
  //Checking if request is from STRIPE
  const payload = req.body;
  const sig = req.headers["stripe-signature"];
  const endpointSecret =
    "my secret endpoint here";
  let event;
  try {
    event = await stripe.webhooks.constructEvent(payload, sig, endpointSecret);
  } catch (err) {
    return res.status(400).send(`Webhook Error: ${err.message}`);
    console.log(err.message);
  }
  //********************************* */
  switch (event.type) {
    case "checkout.session.completed":
      console.log("Code for checkout session completed");
      break;
    case "payment_intent.succeeded":
      console.log("Payment succeeeded");
      break;
    default:
      console.log("???");
  }
  console.log("ndkndnn");
  res.json({ success: true });
});
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!