cal.pub0.org/packages/features/ee/payments/server/stripe.ts

19 lines
345 B
TypeScript

import Stripe from "stripe";
declare global {
// eslint-disable-next-line no-var
var stripe: Stripe | undefined;
}
const stripe =
globalThis.stripe ||
new Stripe(process.env.STRIPE_PRIVATE_KEY!, {
apiVersion: "2020-08-27",
});
if (process.env.NODE_ENV !== "production") {
globalThis.stripe = stripe;
}
export default stripe;