Skip to content

Billing & Subscriptions

The billing system manages subscription plans, pricing, and payment processing through Stripe.

Routes: /billing, /upgrade

FeatureFreeStandardElite
Monthly Price$0$32.99$97.99
Annual Price$0$359.99$1,019.99
Storage10GB100GB500GB
HubsUnlimitedUnlimitedUnlimited
TemplatesBasicAdvancedAll
Theming-YesYes
Custom Domain--Yes
Kickbacks5%10%20%
Commission12%6%3%
Discord-YesPremium Elite
Early Beta--Yes

Data file: src/lib/data/pricing.ts

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 subscription

File: src/lib/stores/plans-manager.svelte.ts

Fetches products and prices from Firestore collection groups:

plansManager.products; // Active Stripe products
plansManager.prices; // Active recurring prices
plansManager.isLoading;

Route: /upgrade

Components:

  • pricing-header.svelte - Title with monthly/annual toggle
  • pricing-plans.svelte - Plan cards with features and pricing
  • pricing-compare.svelte - Feature comparison table

Features:

  • Monthly/annual billing toggle
  • Current plan highlighting
  • Annual discount calculation
  • Stripe checkout for purchase

File: src/lib/services/checkout.service.ts

const checkout = new CheckoutService(userId);
// Subscription checkout
await checkout.createCheckoutSession(priceId, metadata, {
mode: 'subscription',
success_url: '/dashboard',
cancel_url: '/upgrade',
});
// Marketplace checkout (Direct Charges)
await checkout.createMarketplaceCheckout({
priceId,
sellerStripeAccountId,
amountInCents,
metadata,
});

For marketplace transactions:

  • Platform fee: 5% of order amount
  • Applied as application_fee_amount on Direct Charges
  • Processed on seller’s Stripe Connect account

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;
}
IntegrationPurpose
Stripe CheckoutSubscription purchases
Stripe ConnectSeller payment accounts
Stripe Customer PortalSelf-service billing management
Direct ChargesMarketplace payments to sellers
Application FeesPlatform commission collection