From 6d103986b71f3dc7372f351e7b7f4d1389cc6560 Mon Sep 17 00:00:00 2001 From: adueck Date: Sat, 15 Oct 2022 20:52:39 +0500 Subject: [PATCH] diag webhook --- account/src/routers/payment-router.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/account/src/routers/payment-router.ts b/account/src/routers/payment-router.ts index a18f161..36a090c 100644 --- a/account/src/routers/payment-router.ts +++ b/account/src/routers/payment-router.ts @@ -14,6 +14,7 @@ paymentRouter.post( '/webhook', express.raw({ type: 'application/json' }), async (request, response) => { + console.log("in webhook"); let event = request.body; // Replace this endpoint secret with your endpoint's unique secret // If you are testing with the CLI, find the secret by running 'stripe listen' @@ -23,8 +24,10 @@ paymentRouter.post( // Otherwise use the basic event deserialized with JSON.parse const endpointSecret = env.stripeWebhookSecret; if (endpointSecret) { + console.log("endoint Secret", endpointSecret); // Get the signature sent by Stripe const signature = request.headers['stripe-signature'] || ""; + console.log("signature", signature); try { event = stripe.webhooks.constructEvent( request.body, @@ -82,7 +85,7 @@ paymentRouter.post("/create-checkout-session", async (req, res, next) => { try { const source = req.query.source; const returnUrl = source === "dictionary" - ? "https://dictionary.lingodcs.com/account" + ? "https://dictionary.lingdocs.com/account" : "https://account.lingdocs.com/user"; const price = req.body.priceId; const session = await stripe.checkout.sessions.create({