Stripe Setup
HostMetrics uses Stripe for subscription billing. This setup is optional for development if you’re not working on billing features.1. Create a Stripe Account
- Sign up at stripe.com
- Stay in Test Mode (toggle in the top-right of the dashboard)
2. Get API Keys
- Go to Developers > API Keys
- Copy your Publishable key and Secret key
- Add to
.env.local:
3. Set Up Webhook
For local development, use the Stripe CLI:4. Create Products and Plans
In the Stripe Dashboard, create subscription products that match your plan tiers. The webhook handler at/api/stripe/webhook processes these events:
checkout.session.completed— New subscriptioncustomer.subscription.updated— Plan changecustomer.subscription.deleted— Cancellationinvoice.paid— Payment recordedinvoice.payment_failed— Payment failure
If you’re not working on billing features, you can skip Stripe setup entirely. The app works without it — billing pages will show errors but other features are unaffected.