// In supabase/functions/subscription-api/index.ts
const session = await stripe.checkout.sessions.create({
customer: customerId,
payment_method_types: ['card'],
line_items: [
{
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, // $2.50 in cents
recurring: {
interval: 'month',
},
},
quantity: 1,
},
],
// ... rest of session config
})
// In supabase/functions/subscription-api/index.ts
const session = await stripe.checkout.sessions.create({
customer: customerId,
payment_method_types: ['card'],
line_items: [
{
price: Deno.env.get('STRIPE_PREMIUM_PRICE_ID'), // From environment variable
quantity: 1,
},
],
// ... rest of session config (unchanged)
})
price_
)Add to Supabase environment variables:
STRIPE_PREMIUM_PRICE_ID=price_1234567890abcdef
File: supabase/functions/subscription-api/index.ts
Replace this section:
line_items: [
{
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, // $2.50 in cents
recurring: {
interval: 'month',
},
},
quantity: 1,
},
],
With:
line_items: [
{
price: Deno.env.get('STRIPE_PREMIUM_PRICE_ID'),
quantity: 1,
},
],
File: config.js
Add Stripe configuration section:
// Add to window.urlNotesConfig
stripe: {
// These are public-safe identifiers (not secret keys)
premiumPriceId: 'price_1234567890abcdef', // For client-side reference if needed
productName: 'Anchored Premium',
monthlyPrice: 2.50
},
If issues arise, simply revert the code change:
price: Deno.env.get('STRIPE_PREMIUM_PRICE_ID')
back to price_data: {...}
Time Estimate: 2-3 hours
Complexity: Low
This migration is highly recommended because:
The current system is already well-architected and fully compatible with Stripe products. This change simply makes it more professional and easier to manage going forward.