@bates-solutions/stripe API Reference - v2.2.1
    Preparing search index...

    Function parseNextWebhook

    • Verify and parse a webhook event from a Next.js request.

      Use this when you want custom handling instead of automatic processing.

      Parameters

      • request: Request

        The incoming request

      • signingSecret: string

        Your webhook signing secret

      • Optionaloptions: VerifyOptions

        Verification options

      Returns Promise<Event>

      The parsed webhook event

      Error if verification fails

      // 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 });
      }