Files
supanextail/utils/stripe.js
Michael 92f517cad3 First stripe integration.
User can subscribe and it will be effective in the database. We now need to reflect this on the front end.
Issue : Need to check how to upgrade a current subscription
2021-06-24 23:31:41 +02:00

15 lines
332 B
JavaScript

/**
* This is a singleton to ensure we only instantiate Stripe once.
*/
import { loadStripe } from "@stripe/stripe-js";
let stripePromise = null;
const getStripe = () => {
if (!stripePromise) {
stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY);
}
return stripePromise;
};
export default getStripe;