Skip to content

Stripe Integration

Set up Stripe for subscription management on omnilux.tv.

Stripe account setup

  1. Create a Stripe account
  2. For development, use test mode (toggle in the Stripe dashboard)
  3. Get your API keys from Developers > API keys

Environment variables

bash
# 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:

ProductDescription
OmniLux ProPremium features and priority support

Prices

Attach recurring prices to each product:

PriceIntervalAmount
Monthlymonth$X.XX
Annualyear$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:

bash
stripe listen --forward-to localhost:4000/api/stripe/webhook

The CLI prints a webhook signing secret — use it as STRIPE_WEBHOOK_SECRET.

Production

  1. Go to Developers > Webhooks in the Stripe dashboard
  2. Add an endpoint: https://omnilux.tv/api/stripe/webhook
  3. Select events to listen for:
    • checkout.session.completed
    • customer.subscription.created
    • customer.subscription.updated
    • customer.subscription.deleted
    • invoice.payment_succeeded
    • invoice.payment_failed
  4. Copy the webhook signing secret

Checkout flow

  1. User clicks "Subscribe" in the web app
  2. Client creates a Stripe Checkout Session via the server API
  3. User is redirected to Stripe's hosted checkout page
  4. After payment, Stripe redirects back to the app
  5. 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:

bash
# 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.

Use OmniLux, run your own server, or build on the platform.