Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

130
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda