Files
readest/apps/readest-app/src/libs/stripe/server.ts
T
2025-06-29 14:38:04 +02:00

17 lines
397 B
TypeScript

import Stripe from 'stripe';
let stripe: Stripe | null;
export const getStripe = () => {
if (!stripe) {
const stripeSecretKey =
process.env.NODE_ENV === 'production'
? process.env['STRIPE_SECRET_KEY']
: process.env['STRIPE_SECRET_KEY_DEV'];
stripe = new Stripe(stripeSecretKey!, {
httpClient: Stripe.createFetchHttpClient(),
});
}
return stripe;
};