createStripeVerifier
createStripeVerifier(
stripe,webhookSecret):Verifier<Event>
Defined in: stripe/src/index.ts:416
Creates a Stripe webhook verifier function
This verifier handles Stripe signature verification using the stripe-signature header and returns the verified Stripe event.
Parameters
Section titled “Parameters”stripe
Section titled “stripe”Stripe
Pre-configured Stripe instance
webhookSecret
Section titled “webhookSecret”string
Stripe webhook secret (starts with ‘whsec_‘)
Returns
Section titled “Returns”Verifier<Event>
A Verifier function compatible with all Kotodayori adapters
Example
Section titled “Example”import Stripe from 'stripe';import { createStripeVerifier, StripeWebhookRouter } from '@kotodayori/stripe';import { honoAdapter } from '@kotodayori/hono';
const stripe = new Stripe(process.env.STRIPE_API_KEY!);const router = new StripeWebhookRouter();
// With Honoapp.post('/webhook', honoAdapter(router, { verifier: createStripeVerifier(stripe, process.env.STRIPE_WEBHOOK_SECRET!),}));
// With Expressapp.post('/webhook', express.raw({ type: 'application/json' }), expressAdapter(router, { verifier: createStripeVerifier(stripe, process.env.STRIPE_WEBHOOK_SECRET!), }));
// With Lambdaexport const handler = lambdaAdapter(router, { verifier: createStripeVerifier(stripe, process.env.STRIPE_WEBHOOK_SECRET!),});