Files
Shifted/lib/stripeClient.ts
2026-02-10 01:14:19 +00:00

25 lines
643 B
TypeScript

import Stripe from "stripe";
// Centralized Stripe client. All Stripe requests should use this instance.
// The SDK automatically uses the latest API version configured for your account.
const secretKey = process.env.STRIPE_SECRET_KEY;
function missingKeyError() {
return new Error(
"Missing STRIPE_SECRET_KEY. Add it to your environment before starting the server."
);
}
export const stripeClient: Stripe = secretKey
? new Stripe(secretKey, {
// No explicit apiVersion needed per requirements.
})
: (new Proxy(
{},
{
get() {
throw missingKeyError();
},
}
) as Stripe);