mirror of
https://github.com/Since-3/Kuma.git
synced 2026-10-12 19:51:17 +00:00
fixed build
This commit is contained in:
parent
6006fbd9fa
commit
7f921103b3
1 changed files with 16 additions and 5 deletions
|
|
@ -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 ?? "";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue