open-prompt / src /lib /stripe.ts
GitHub Action
Automated sync to Hugging Face
bcce530
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