Billing & Subscriptions
Overview
Section titled “Overview”The billing system manages subscription plans, pricing, and payment processing through Stripe.
Routes: /billing, /upgrade
Pricing Plans
Section titled “Pricing Plans”| Feature | Free | Standard | Elite |
|---|---|---|---|
| Monthly Price | $0 | $32.99 | $97.99 |
| Annual Price | $0 | $359.99 | $1,019.99 |
| Storage | 10GB | 100GB | 500GB |
| Hubs | Unlimited | Unlimited | Unlimited |
| Templates | Basic | Advanced | All |
| Theming | - | Yes | Yes |
| Custom Domain | - | - | Yes |
| Kickbacks | 5% | 10% | 20% |
| Commission | 12% | 6% | 3% |
| Discord | - | Yes | Premium Elite |
| Early Beta | - | - | Yes |
Data file: src/lib/data/pricing.ts
Subscription Management
Section titled “Subscription Management”subscriptionManager
Section titled “subscriptionManager”File: src/lib/stores/subscription-manager.svelte.ts
Reads active subscriptions from users/{uid}/subscriptions/ with priority logic: Elite > Pro > Standard > Free.
subscriptionManager.subscriptionData; // Current active subscription// Falls back to Free if no active subscriptionplansManager
Section titled “plansManager”File: src/lib/stores/plans-manager.svelte.ts
Fetches products and prices from Firestore collection groups:
plansManager.products; // Active Stripe productsplansManager.prices; // Active recurring pricesplansManager.isLoading;Upgrade Page
Section titled “Upgrade Page”Route: /upgrade
Components:
pricing-header.svelte- Title with monthly/annual togglepricing-plans.svelte- Plan cards with features and pricingpricing-compare.svelte- Feature comparison table
Features:
- Monthly/annual billing toggle
- Current plan highlighting
- Annual discount calculation
- Stripe checkout for purchase
Checkout Flow
Section titled “Checkout Flow”File: src/lib/services/checkout.service.ts
const checkout = new CheckoutService(userId);
// Subscription checkoutawait checkout.createCheckoutSession(priceId, metadata, { mode: 'subscription', success_url: '/dashboard', cancel_url: '/upgrade',});
// Marketplace checkout (Direct Charges)await checkout.createMarketplaceCheckout({ priceId, sellerStripeAccountId, amountInCents, metadata,});Platform Fee
Section titled “Platform Fee”For marketplace transactions:
- Platform fee: 5% of order amount
- Applied as
application_fee_amounton Direct Charges - Processed on seller’s Stripe Connect account
Billing Data Types
Section titled “Billing Data Types”File: src/lib/data/billing.ts
interface SubscriptionPlan { planName: string; status: 'active' | 'inactive' | 'cancelled'; renewalDate: string; price: number; billingPeriod: 'monthly' | 'annual';}
interface PaymentMethod { type: 'visa' | 'mastercard' | 'american_express'; last4: string; expiry: string; isDefault: boolean;}
interface Invoice { invoiceNumber: string; amount: number; status: 'paid' | 'pending' | 'failed'; downloadUrl?: string;}Stripe Integration Points
Section titled “Stripe Integration Points”| Integration | Purpose |
|---|---|
| Stripe Checkout | Subscription purchases |
| Stripe Connect | Seller payment accounts |
| Stripe Customer Portal | Self-service billing management |
| Direct Charges | Marketplace payments to sellers |
| Application Fees | Platform commission collection |