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/webhook/stripe/route.js

Anil Chandra Naidu Matchad2636d826378
diff --git a/src/app/api/webhook/stripe/route.js b/src/app/api/webhook/stripe/route.js
new file mode 100644
index 0000000..3354845
--- /dev/null
+++ b/src/app/api/webhook/stripe/route.js
@@ -0,0 +1,21 @@
+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 headersList = await headers();
+ const signature = headersList.get("stripe-signature");
+
+ if (!signature) {
+ return NextResponse.json({ error: "Missing stripe-signature header" }, { status: 400 });
+ }
+
+ const result = await BillingService.handleWebhook(body, signature);
+ return NextResponse.json(result);
+ } catch (error) {
+ console.error("Stripe webhook processing error:", error);
+ return NextResponse.json({ error: error.message }, { status: 500 });
+ }
+}