Skip to content

50+ open-source generative AI apps you can clone, deploy, and monetize — image generators, video tools, virtual try-ons, AI SaaS templates, and platform integrations. One-click Vercel deploy on every template.

Restore: src/app/api/stripe/webhook/route.js

Anil Chandra Naidu Matcha2e189c4cae22
diff --git a/src/app/api/stripe/webhook/route.js b/src/app/api/stripe/webhook/route.js
new file mode 100644
index 0000000..f3a3e1a
--- /dev/null
+++ b/src/app/api/stripe/webhook/route.js
@@ -0,0 +1,16 @@
+import { NextResponse } from "next/server";
+import { headers } from "next/headers";
+import { BillingService } from "@/lib/services/billing";
+
+export async function POST(req) {
+ try {
+ const body = await req.text();
+ const signature = (await headers()).get("Stripe-Signature");
+
+ const result = await BillingService.handleWebhook(body, signature);
+ return NextResponse.json(result);
+ } catch (error) {
+ console.error("[STRIPE_WEBHOOK]", error);
+ return new NextResponse(`Webhook Error: ${error.message}`, { status: 400 });
+ }
+}