From 12df8062119b8353d881dfd880e051783589bf5e Mon Sep 17 00:00:00 2001 From: Kiran K Date: Thu, 23 Oct 2025 22:27:02 +0530 Subject: [PATCH 1/2] Update route.ts --- apps/web/app/(ee)/api/stripe/integration/webhook/route.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/web/app/(ee)/api/stripe/integration/webhook/route.ts b/apps/web/app/(ee)/api/stripe/integration/webhook/route.ts index 190ea45bfac..010140a0c43 100644 --- a/apps/web/app/(ee)/api/stripe/integration/webhook/route.ts +++ b/apps/web/app/(ee)/api/stripe/integration/webhook/route.ts @@ -67,6 +67,13 @@ export const POST = withAxiom(async (req: Request) => { }); } + // When an app is installed in live mode, it receives both live and test mode events + // We need to check the event's livemode property to determine the correct mode to use + // See: https://docs.stripe.com/stripe-apps/build-backend#sandbox-mode + if (mode === "live" && !event.livemode) { + mode = "test"; + } + let response = "OK"; switch (event.type) { From 3f4800ede71b7cc8d4cb7af905fd7b8f139aedca Mon Sep 17 00:00:00 2001 From: Steven Tey Date: Thu, 23 Oct 2025 10:23:16 -0700 Subject: [PATCH 2/2] update implementation --- .../(ee)/api/stripe/integration/webhook/route.ts | 13 ++++++++----- .../(dashboard)/profile/profile-details-form.tsx | 1 - 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/web/app/(ee)/api/stripe/integration/webhook/route.ts b/apps/web/app/(ee)/api/stripe/integration/webhook/route.ts index 010140a0c43..3246e81fc8c 100644 --- a/apps/web/app/(ee)/api/stripe/integration/webhook/route.ts +++ b/apps/web/app/(ee)/api/stripe/integration/webhook/route.ts @@ -67,11 +67,14 @@ export const POST = withAxiom(async (req: Request) => { }); } - // When an app is installed in live mode, it receives both live and test mode events - // We need to check the event's livemode property to determine the correct mode to use - // See: https://docs.stripe.com/stripe-apps/build-backend#sandbox-mode - if (mode === "live" && !event.livemode) { - mode = "test"; + // When an app is installed in both live & test mode, + // test mode events are sent to both the test mode and live mode endpoints, + // and live mode events are sent to the live mode endpoint. + // See: https://docs.stripe.com/stripe-apps/build-backend#event-behavior-depends-on-install-mode + if (!event.livemode && mode === "live") { + return logAndRespond( + `Received a test webhook event (${event.type}) on our live webhook receiver endpoint, skipping...`, + ); } let response = "OK"; diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-details-form.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-details-form.tsx index 964584b6a0e..8970ec6d66f 100644 --- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-details-form.tsx +++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-details-form.tsx @@ -309,7 +309,6 @@ function BasicInfoForm({ )}