Webhook configuration
An async handler: (request: Request) => Promise<Response>
// Supabase Edge Function / Deno
import { createWebhookHandler } from '@bates-solutions/stripe/server';
const handler = createWebhookHandler({
signingSecret: Deno.env.get('STRIPE_WEBHOOK_SECRET')!,
handlers: {
'checkout.session.completed': async (event) => {
await activateSubscription(event.data.object);
},
},
});
Deno.serve(handler);
Create a framework-neutral webhook handler built on the Web platform.
Takes a standard
Requestand returns a standardResponse, using only Web APIs (request.text(), WebCrypto verification,Response.json). It runs unchanged on any runtime that speaks the Fetch API — Deno (Deno.serve), Cloudflare Workers, Bun, Vercel/Netlify edge, and Next.js App Router.