16 lines
508 B
TypeScript
16 lines
508 B
TypeScript
import { loadStripe } from "@stripe/stripe-js";
|
|
|
|
// Stripe.js client loader for Elements.
|
|
const publishableKey = process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY;
|
|
|
|
if (!publishableKey) {
|
|
// This error will surface in the browser console. Keep it explicit and helpful.
|
|
// eslint-disable-next-line no-console
|
|
console.error(
|
|
"Missing NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY. Add it to your environment for Stripe.js."
|
|
);
|
|
}
|
|
|
|
export const stripePromise = publishableKey ? loadStripe(publishableKey) : null;
|
|
|