import type Stripe from "stripe"; /** * The events the webhook must deliver: the ones that move money. * * Mirrors PAYMENT_EVENT_TYPES in sync.ts. Subscription state is deliberately * absent — it's a projection the poller mirrors, and a minute of staleness there * costs nothing, whereas a missed credit is a customer who paid and got nothing. */ export declare const BILLING_WEBHOOK_EVENTS: readonly ["checkout.session.completed", "invoice.paid", "invoice.payment_failed"]; export type EnsureWebhookResult = { id: string; url: string; /** * OTHER endpoint ids registered on the same URL. Stripe allows duplicates and * delivers to every one of them, so this is usually an accident worth acting * on (harmless for credits, which are idempotent, but it doubles delivery * volume and makes logs lie). Pass `pruneDuplicates` to remove them. */ duplicates: string[]; /** * The signing secret for STRIPE_WEBHOOK_SECRET. * * Present only when this call CREATED the endpoint: Stripe returns it once and * never again ("Only returned at creation"). For an endpoint that already * exists, keep the secret you stored — or pass `recreate: true` to replace the * endpoint and mint a fresh one. */ secret?: string; created: boolean; /** The event list differed and was updated in place. */ updated: boolean; }; /** * Idempotently ensure a webhook endpoint for `url`, matched on the URL. * * Safe to run on every deploy: an existing endpoint is reused, and its event * list is corrected only when it has drifted. */ export declare function ensureWebhookEndpoint(opts: { /** Absolute URL of your handler, e.g. https://example.com/api/stripe/webhook */ url: string; /** Defaults to BILLING_WEBHOOK_EVENTS. */ events?: readonly Stripe.WebhookEndpointCreateParams.EnabledEvent[]; description?: string; /** Delete and re-create, to mint a new signing secret. Destructive: the old * secret stops verifying as soon as this runs. */ recreate?: boolean; /** * Replace the event list with exactly `events` instead of adding to it. * * Off by default, and that default is the important one: an endpoint you * didn't create may legitimately carry events another consumer depends on, and * silently narrowing it in a deploy script turns their handler into a no-op * with nothing in the logs. The union can only ever over-deliver, which costs * a discarded event. */ exact?: boolean; /** Delete other endpoints registered on the same URL. Destructive. */ pruneDuplicates?: boolean; }): Promise; //# sourceMappingURL=webhook-setup.d.ts.map