40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
/**
|
|
* Stripe configuration (frontend) for the Payments module.
|
|
*
|
|
* Only the PUBLISHABLE key lives on the frontend — it is safe to expose. The
|
|
* Secret Key and Webhook Secret are backend-only (see /api/payments/*).
|
|
*
|
|
* Set in `.env` (see .env.example):
|
|
* VITE_STRIPE_PUBLISHABLE_KEY=pk_test_… or pk_live_…
|
|
*
|
|
* Until a real key is provided, `isConfigured` is false and the UI shows a
|
|
* clear "configure Stripe" notice rather than attempting a broken redirect.
|
|
*/
|
|
|
|
const PLACEHOLDER = 'pk_test_REPLACE_WITH_YOUR_PUBLISHABLE_KEY';
|
|
|
|
const publishableKey = import.meta.env.VITE_STRIPE_PUBLISHABLE_KEY || PLACEHOLDER;
|
|
|
|
export const stripeConfig = {
|
|
publishableKey,
|
|
|
|
// Base path for the payment API endpoints (Vercel serverless functions).
|
|
apiBase: '/api/payments',
|
|
|
|
// True only when a real publishable key is present.
|
|
isConfigured:
|
|
typeof publishableKey === 'string' &&
|
|
publishableKey.startsWith('pk_') &&
|
|
publishableKey !== PLACEHOLDER,
|
|
|
|
currency: 'usd',
|
|
locale: 'en-US',
|
|
|
|
merchant: {
|
|
name: 'LynkedUp Pro Roofing',
|
|
supportEmail: 'billing@lynkeduppro.com',
|
|
},
|
|
};
|
|
|
|
export default stripeConfig;
|