Stripe Integration
Set up Stripe for subscription management on omnilux.tv.
Stripe account setup
- Create a Stripe account
- For development, use test mode (toggle in the Stripe dashboard)
- Get your API keys from Developers > API keys
Environment variables
# Server-side (never expose these)
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
# Client-side (safe to expose)
VITE_STRIPE_PUBLISHABLE_KEY=pk_test_...Product and price configuration
Create products and prices in the Stripe dashboard or via the API:
Products
Create a product for each subscription tier:
| Product | Description |
|---|---|
| OmniLux Pro | Premium features and priority support |
Prices
Attach recurring prices to each product:
| Price | Interval | Amount |
|---|---|---|
| Monthly | month | $X.XX |
| Annual | year | $XX.XX |
Note the price IDs (e.g., price_1234...) — these are used in the checkout flow.
Webhook setup
Webhooks notify your server when subscription events occur (payment success, cancellation, etc.).
Local development
Use the Stripe CLI to forward webhooks locally:
stripe listen --forward-to localhost:4000/api/stripe/webhookThe CLI prints a webhook signing secret — use it as STRIPE_WEBHOOK_SECRET.
Production
- Go to Developers > Webhooks in the Stripe dashboard
- Add an endpoint:
https://omnilux.tv/api/stripe/webhook - Select events to listen for:
checkout.session.completedcustomer.subscription.createdcustomer.subscription.updatedcustomer.subscription.deletedinvoice.payment_succeededinvoice.payment_failed
- Copy the webhook signing secret
Checkout flow
- User clicks "Subscribe" in the web app
- Client creates a Stripe Checkout Session via the server API
- User is redirected to Stripe's hosted checkout page
- After payment, Stripe redirects back to the app
- Webhook confirms the subscription and updates the database
Test mode vs live mode
- Test mode: use test API keys (
sk_test_,pk_test_). No real charges. Use test card numbers - Live mode: use live API keys (
sk_live_,pk_live_). Real charges
Always develop and test with test mode. Switch to live mode only for production.
Customer portal
Stripe provides a hosted customer portal for subscription management:
# Create a portal session (server-side)
const session = await stripe.billingPortal.sessions.create({
customer: customerId,
return_url: 'https://omnilux.tv/settings',
});The portal allows users to update payment methods, view invoices, and cancel subscriptions without custom UI.