Add Stripe subscription integration with pricing plans
This commit is contained in:
76
src/lib/stripe.ts
Normal file
76
src/lib/stripe.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
import Stripe from 'stripe';
|
||||
|
||||
if (!process.env.STRIPE_SECRET_KEY) {
|
||||
throw new Error('STRIPE_SECRET_KEY is not set');
|
||||
}
|
||||
|
||||
export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY, {
|
||||
apiVersion: '2024-11-20.acacia',
|
||||
typescript: true,
|
||||
});
|
||||
|
||||
export const STRIPE_PLANS = {
|
||||
FREE: {
|
||||
name: 'Free / Starter',
|
||||
price: 0,
|
||||
currency: 'EUR',
|
||||
interval: 'month',
|
||||
features: [
|
||||
'3 dynamische QR-Codes',
|
||||
'Basis-Tracking (Scans + Standort)',
|
||||
'Einfache Designs',
|
||||
'Unbegrenzte statische QR-Codes',
|
||||
],
|
||||
limits: {
|
||||
dynamicQRCodes: 3,
|
||||
staticQRCodes: -1, // unlimited
|
||||
teamMembers: 1,
|
||||
},
|
||||
priceId: null, // No Stripe price for free plan
|
||||
},
|
||||
PRO: {
|
||||
name: 'Pro',
|
||||
price: 9,
|
||||
priceYearly: 90,
|
||||
currency: 'EUR',
|
||||
interval: 'month',
|
||||
features: [
|
||||
'50 QR-Codes',
|
||||
'Branding (Logo, Farben)',
|
||||
'Detaillierte Analytics (Datum, Gerät, Stadt)',
|
||||
'CSV-Export',
|
||||
'Passwortschutz',
|
||||
],
|
||||
limits: {
|
||||
dynamicQRCodes: 50,
|
||||
staticQRCodes: -1,
|
||||
teamMembers: 1,
|
||||
},
|
||||
priceId: process.env.STRIPE_PRICE_ID_PRO_MONTHLY,
|
||||
priceIdYearly: process.env.STRIPE_PRICE_ID_PRO_YEARLY,
|
||||
},
|
||||
BUSINESS: {
|
||||
name: 'Business',
|
||||
price: 29,
|
||||
priceYearly: 290,
|
||||
currency: 'EUR',
|
||||
interval: 'month',
|
||||
features: [
|
||||
'500 QR-Codes',
|
||||
'Team-Zugänge (bis 3 User)',
|
||||
'API-Zugang',
|
||||
'Benutzerdefinierte Domains',
|
||||
'White-Label',
|
||||
'Prioritäts-Support',
|
||||
],
|
||||
limits: {
|
||||
dynamicQRCodes: 500,
|
||||
staticQRCodes: -1,
|
||||
teamMembers: 3,
|
||||
},
|
||||
priceId: process.env.STRIPE_PRICE_ID_BUSINESS_MONTHLY,
|
||||
priceIdYearly: process.env.STRIPE_PRICE_ID_BUSINESS_YEARLY,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export type PlanType = keyof typeof STRIPE_PLANS;
|
||||
Reference in New Issue
Block a user