File size: 1,376 Bytes
bcce530
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import Stripe from 'stripe'

if (!process.env.STRIPE_SECRET_KEY) {
    // Only throw at runtime, not at build/import time
    if (process.env.NODE_ENV === 'production') {
        console.error('STRIPE_SECRET_KEY is not set in production')
    }
}

export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || 'sk_test_placeholder', {
    apiVersion: '2026-04-22.dahlia',
    typescript: true,
})


// Pricing configuration — change these IDs after creating products in Stripe Dashboard
export const STRIPE_PRICES = {
    pro_monthly: process.env.STRIPE_PRO_MONTHLY_PRICE_ID || '',
    pro_yearly: process.env.STRIPE_PRO_YEARLY_PRICE_ID || '',
} as const

export type StripePlan = keyof typeof STRIPE_PRICES

export const PLAN_FEATURES = {
    free: {
        name: 'Free',
        price: 0,
        maxToolExecutions: 20,      // per day
        maxPrompts: 10,
        privatePrompts: false,
        apiAccess: false,
        executionHistory: false,
        advancedAnalytics: false,
        removeBranding: false,
    },
    pro: {
        name: 'Pro',
        price: 9,
        maxToolExecutions: Infinity, // unlimited
        maxPrompts: Infinity,
        privatePrompts: true,
        apiAccess: true,
        executionHistory: true,
        advancedAnalytics: true,
        removeBranding: true,
    },
} as const

export type Plan = keyof typeof PLAN_FEATURES