This commit is contained in:
@@ -29,13 +29,13 @@
|
||||
import Stripe from "stripe";
|
||||
import type { Invoice } from "@/types";
|
||||
|
||||
// Pinned API version. This is a string-literal type in the Stripe
|
||||
// SDK — the explicit `Stripe.LatestApiVersion` annotation forces a
|
||||
// compile error when the installed SDK ships with a different pin,
|
||||
// so a `npm update` that bumps Stripe to a new API version gets
|
||||
// caught here rather than at runtime. Bump this string deliberately
|
||||
// alongside the SDK upgrade and review the API changelog.
|
||||
const STRIPE_API_VERSION: Stripe.LatestApiVersion = "2026-04-22.dahlia";
|
||||
// Pinned API version. `as const` narrows this to a string-literal
|
||||
// type that the Stripe constructor's `apiVersion` field accepts
|
||||
// exactly. When the installed SDK bumps to a new pinned version,
|
||||
// TypeScript will surface the mismatch at the `new Stripe(...)` call
|
||||
// below — bump this string deliberately alongside the SDK upgrade
|
||||
// and review the API changelog before doing so.
|
||||
const STRIPE_API_VERSION = "2026-04-22.dahlia" as const;
|
||||
|
||||
// Cache the client across hot reloads / serverless invocations.
|
||||
// We don't instantiate at module load because some build steps run
|
||||
|
||||
Reference in New Issue
Block a user