fixed build

This commit is contained in:
Rajpreet0 2026-05-15 02:07:08 +02:00
parent 6006fbd9fa
commit 7f921103b3

View file

@ -1,12 +1,23 @@
import Stripe from "stripe";
if (!process.env.STRIPE_SECRET_KEY) {
throw new Error("STRIPE_SECRET_KEY ist nicht gesetzt");
let _stripe: Stripe | null = null;
function getStripeClient(): Stripe {
if (_stripe) return _stripe;
if (!process.env.STRIPE_SECRET_KEY) {
throw new Error("STRIPE_SECRET_KEY ist nicht gesetzt");
}
_stripe = new Stripe(process.env.STRIPE_SECRET_KEY, {
apiVersion: "2026-04-22.dahlia",
typescript: true,
});
return _stripe;
}
export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY, {
apiVersion: "2026-04-22.dahlia",
typescript: true,
export const stripe = new Proxy({} as Stripe, {
get(_target, prop) {
return Reflect.get(getStripeClient(), prop, getStripeClient());
},
});
export const STRIPE_WEBHOOK_SECRET = process.env.STRIPE_WEBHOOK_SECRET ?? "";