Initial commit: PodcastYes — AI podcast platform

This commit is contained in:
Leon Serfaty
2026-06-07 03:58:32 -04:00
commit 155507f21a
151 changed files with 19826 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
import { NextRequest } from "next/server";
import type Stripe from "stripe";
import { stripe } from "@/lib/billing/stripe";
import { handleStripeEvent } from "@/lib/billing/webhooks/stripe";
export const dynamic = "force-dynamic";
export async function POST(req: NextRequest) {
const secret = process.env.STRIPE_WEBHOOK_SECRET;
const signature = req.headers.get("stripe-signature");
if (!secret || !signature) return new Response("Webhook not configured", { status: 400 });
const body = await req.text();
let event: Stripe.Event;
try {
event = stripe().webhooks.constructEvent(body, signature, secret);
} catch (err) {
console.error("[stripe webhook] signature verification failed", err);
return new Response("Invalid signature", { status: 400 });
}
try {
await handleStripeEvent(event);
} catch (err) {
console.error("[stripe webhook] handler error", err);
return new Response("Handler error", { status: 500 });
}
return new Response("ok");
}