honoAdapter
honoAdapter<
TEventMap>(router,options): (c) =>Promise<Response>
Defined in: hono/src/index.ts:38
Creates a Hono handler for handling webhooks
Hono’s c.req.text() retrieves the raw request body as a string,
which is used directly for signature verification.
Type Parameters
Section titled “Type Parameters”TEventMap
Section titled “TEventMap”TEventMap extends Record<string, WebhookEvent>
Parameters
Section titled “Parameters”router
Section titled “router”WebhookRouter<TEventMap>
The WebhookRouter instance
options
Section titled “options”HonoAdapterOptions<TEventMap[keyof TEventMap]>
Adapter options including a verifier function
Returns
Section titled “Returns”Hono handler function
(
c):Promise<Response>
Parameters
Section titled “Parameters”Context
Returns
Section titled “Returns”Promise<Response>
Example
Section titled “Example”import { Hono } from 'hono';import { honoAdapter } from '@kotodayori/hono';import { createStripeVerifier, StripeWebhookRouter } from '@kotodayori/stripe';
const router = new StripeWebhookRouter();const app = new Hono();
app.post('/webhook', honoAdapter(router, { verifier: createStripeVerifier(stripe, process.env.STRIPE_WEBHOOK_SECRET!),}));