20 lines
389 B
TypeScript
20 lines
389 B
TypeScript
import Stripe from "stripe";
|
|
|
|
import { env } from "@/lib/env";
|
|
|
|
let stripeClient: Stripe | null = null;
|
|
|
|
export function getStripeClient() {
|
|
if (!env.stripeSecretKey) {
|
|
throw new Error("STRIPE_SECRET_KEY is not configured");
|
|
}
|
|
|
|
if (!stripeClient) {
|
|
stripeClient = new Stripe(env.stripeSecretKey, {
|
|
apiVersion: "2025-02-24.acacia",
|
|
});
|
|
}
|
|
|
|
return stripeClient;
|
|
}
|