Skip to main content

Billing & Subscriptions

HostMetrics uses Stripe for subscription billing. The billing system manages plan tiers, payment methods, checkout, and subscription lifecycle.

Plan Tiers

Plans are stored in the plans table. Each tier defines:
  • Monthly and annual pricing
  • Feature limits (number of vehicles, investors, imports)
  • Access to premium features (reports, fleet pages, toll sync)
The BillingCycleToggle component lets users switch between monthly and annual pricing views. PlanComparisonModal shows a side-by-side feature comparison.

Checkout Flow

  1. User clicks upgrade on CurrentPlanCard
  2. API creates a Stripe Checkout session
  3. User is redirected to Stripe’s hosted checkout page
  4. On success, Stripe sends a webhook to the app
  5. The webhook handler creates/updates the subscriptions record

Subscription Lifecycle

The CancelSubscriptionDialog handles cancellation with confirmation and reason collection.

Payment Methods

Users manage saved cards via PaymentMethodsCard and AddPaymentMethodDialog. Payment methods are stored in Stripe and referenced in the payment_methods table.

Customer Portal

The StripeConnectButton redirects users to Stripe’s Customer Portal where they can:
  • Update payment methods
  • View invoice history
  • Download receipts
  • Manage subscription

Webhook Processing

The Stripe webhook route processes these events:
The webhook endpoint must verify Stripe’s signature to prevent spoofing. The signing secret is configured via environment variable.

Key Components

Key Files