Restaq
Reference

@restaq/stripe

Stripe webhook plugin with signature verification and fully-typed event catalog.

Install

pnpm add @restaq/stripe stripe

Peer dependencies: @restaq/core, stripe (>=17)

Exports

ExportKindDescription
stripeFunctionCreates a Stripe plugin for webhook ingestion.
StripeEventMapTypeFully-typed catalog of every Stripe event, keyed by Restaq's namespacing.
StripePluginOptionsTypeConfiguration for the Stripe plugin.

Types

StripeEventMap

type StripeEventMap = {
  [K in Stripe.Event['type'] as `stripe.${K}`]: Extract<Stripe.Event, { type: K }>['data'];
};

A fully-typed map of every Stripe webhook event. Event keys are prefixed with "stripe." (e.g., "stripe.charge.succeeded"), and values are the corresponding Stripe data payload. Derived from the official stripe package's event types, so the catalog tracks whichever Stripe version your application has installed.

StripePluginOptions

type StripePluginOptions = {
  webhookSecret?: string;
  toleranceSeconds?: number;
};

Configuration for the Stripe plugin. webhookSecret defaults to process.env.STRIPE_WEBHOOK_SECRET if not passed. toleranceSeconds (default: 300) sets the maximum age of a signed timestamp before it's rejected.

Functions

stripe

function stripe(options?: StripePluginOptions): RelayPlugin<StripeEventMap>;

Creates a Stripe plugin. Verifies webhook signatures using Stripe's HMAC-SHA256 scheme and normalizes incoming events into Restaq's format. Registers as the "stripe" provider and makes all Stripe event types available for typed handler registration via relay.on().

See also

On this page