File size: 483 Bytes
60faa09 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import Stripe from "stripe";
import config from "./config";
const apiKey =
config.stripe.secretKey && config.stripe.secretKey.trim() !== ""
? config.stripe.secretKey
: "sk_test_placeholder_key_for_build_purposes";
let _stripe = null;
export function getStripe() {
if (!_stripe) {
_stripe = new Stripe(apiKey, { apiVersion: "2024-04-10" });
}
return _stripe;
}
export const stripe = new Proxy({}, {
get(_target, prop) {
return getStripe()[prop];
},
});
|