import type { NextApiRequest } from "next";
import type Stripe from "stripe";
import { HttpError } from '../../../../../lib/http-error';
/** Stripe Webhook Handler Mappings */
export type SWHMap = {
    [T in Stripe.DiscriminatedEvent as T["type"]]: {
        [K in keyof T as Exclude<K, "type">]: T[K];
    };
};
export type LazyModule<D> = Promise<{
    default: (data: D) => unknown | Promise<unknown>;
}>;
type SWHandlers = {
    [K in keyof SWHMap]?: () => LazyModule<SWHMap[K]["data"]>;
};
/** Just a shorthand for HttpError  */
export declare class HttpCode extends HttpError {
    constructor(statusCode: number, message: string);
}
/**
 * Allows us to split big API handlers by webhook event, and lazy load them.
 * It already handles the Stripe signature verification and event construction.
 * @param handlers - A mapping of Stripe webhook event types to lazy loaded handlers.
 * @returns A function that can be used as a Next.js API handler.
 * @example
 * ```ts
 * stripeWebhookHandler({
 *   "payment_intent.succeeded": () => import("./_lazyLoadedSuccessHandler"),
 *   "customer.subscription.deleted": () => import("./_customer.subscription.deleted"),
 * })
 * ```
 */
export declare const stripeWebhookHandler: (handlers: SWHandlers) => (req: NextApiRequest) => Promise<unknown>;
export {};
//# sourceMappingURL=__handler.d.ts.map