Download src/app/api/webhook/stripe/route.js from NeoPy/hugging-c-ai: direct link, hf CLI and curl.
- Browser
- Download file 715 Bytes
-
https://huggingface.co/NeoPy/hugging-c-ai/resolve/main/src/app/api/webhook/stripe/route.js
- Command line
-
hf download hf://NeoPy/hugging-c-ai/src/app/api/webhook/stripe/route.js
-
curl -L -o route.js https://huggingface.co/NeoPy/hugging-c-ai/resolve/main/src/app/api/webhook/stripe/route.js
715 Bytes
| 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 }); | |
| } | |
| } | |