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