The incoming request
Your webhook signing secret
Optionaloptions: VerifyOptions
Verification options
The parsed webhook event
// app/api/webhook/route.ts
import { parseNextWebhook } from '@bates-solutions/stripe/server';
export async function POST(request: Request) {
const event = await parseNextWebhook(request, process.env.STRIPE_WEBHOOK_SECRET!);
switch (event.type) {
case 'payment_intent.succeeded':
// ...
}
return Response.json({ received: true });
}
Verify and parse a webhook event from a Next.js request.
Use this when you want custom handling instead of automatic processing.