Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update route.ts

Kiran K052ff1b54023
diff --git a/apps/web/app/api/stripe/integration/webhook/route.ts b/apps/web/app/api/stripe/integration/webhook/route.ts
index 54f83a65c9..fc9cd0f704 100644
--- a/apps/web/app/api/stripe/integration/webhook/route.ts
+++ b/apps/web/app/api/stripe/integration/webhook/route.ts
@@ -17,8 +17,12 @@ const relevantEvents = new Set([
export const POST = withAxiom(
async (req: Request) => {
const buf = await req.text();
+ const { livemode } = JSON.parse(buf);
+
const sig = req.headers.get("Stripe-Signature");
- const webhookSecret = process.env.STRIPE_APP_WEBHOOK_SECRET;
+ const webhookSecret = livemode
+ ? process.env.STRIPE_APP_WEBHOOK_SECRET
+ : process.env.STRIPE_APP_WEBHOOK_SECRET_TEST;
if (!sig || !webhookSecret) {
return new Response("Invalid request", {