Added Stripe product configuration with predefined product and price IDs:
stripe: {
// Predefined Stripe product and price IDs (public-safe identifiers)
productId: 'prod_T2kES07o4K6Gzk',
premiumPriceId: 'price_1S6ek9AmZvKSDgI488vHQ0Tq',
productName: 'Anchored Premium',
monthlyPrice: 2.50,
currency: 'usd'
}
Replaced manual price_data creation with predefined price ID:
// Before (manual price creation):
price_data: {
currency: 'usd',
product_data: {
name: 'Anchored Premium',
description: 'Cloud sync, web app access, unlimited exports, and 500 AI tokens per month',
},
unit_amount: 250,
recurring: { interval: 'month' },
}
// After (predefined product):
price: Deno.env.get('STRIPE_PREMIUM_PRICE_ID') || 'price_1S6ek9AmZvKSDgI488vHQ0Tq'
Applied the same migration to the subscription management function.
Added logging to show which product and price ID is being used in checkout sessions.
✅ Better Analytics: Stripe Dashboard now shows clear product performance metrics ✅ Easier Management: Pricing changes can be made from Stripe Dashboard ✅ Professional Setup: Industry-standard approach using predefined products ✅ Future Scalability: Easy to add multiple tiers or pricing options ✅ Improved Webhooks: More reliable product identification in webhook events
The implementation uses the environment variable STRIPE_PREMIUM_PRICE_ID
with a fallback to the hardcoded price ID:
STRIPE_PREMIUM_PRICE_ID
price_1S6ek9AmZvKSDgI488vHQ0Tq
prod_T2kES07o4K6Gzk
✅ No Breaking Changes: Existing subscriptions continue to work ✅ Customer Portal: Unchanged functionality ✅ Webhook Processing: Compatible with existing webhook handlers ✅ Database Schema: No changes required
If issues arise, simply revert the price:
parameter back to price_data:
object in both functions.