Skip to main content

Setting Up Stripe Live Mode

Transitioning from Stripe's test mode to live mode is a crucial step in preparing your application for production. This guide will walk you through the process of setting up Stripe live mode and creating your products and prices.

Prerequisites

  • A Stripe account with completed verification for live mode.
  • Your application's Stripe integration tested thoroughly in test mode.

Steps to Set Up Stripe Live Mode

1. Switch to Live Mode

  1. Log in to your Stripe Dashboard.
  2. In the top-right corner, switch from "Test Data" to "Live" mode.

2. Set Up Your Live Webhook

To streamline the webhook setup process, you can use the following pre-configured Stripe webhook creation link:

Create Stripe Webhook with Pre-configured Events


If you'd rather set up the webhook manually, follow these steps:

  1. In the Stripe Dashboard, go to "Developers" > "Webhooks".
  2. Click "Add endpoint".
  3. Enter your production webhook URL: https://yourdomain.com/api/stripe/webhook.
  4. Select the following events to listen to:
    • checkout.session.completed
    • customer.subscription.created
    • customer.subscription.updated
    • customer.subscription.deleted
    • invoice.paid
    • invoice.payment_failed
    • customer.updated
    • customer.deleted
    • payment_intent.succeeded
    • payment_intent.payment_failed
    • charge.succeeded
  5. Click "Add events", then "Add endpoint" to create your webhook.
  6. Note down the "Signing secret" for your webhook.

3. Create Products and Prices

  1. Navigate to "Products" in your Stripe Dashboard.
  2. Click "Add product" for each product you want to offer.
  3. Fill in the product details, including name and description.
  4. Under "Pricing", set up your pricing tiers:
    • For recurring subscriptions, choose "Recurring price".
    • Set the price and billing interval (e.g., $10 per month).
  5. Click "Save product" to create the product and its associated price.

4. Update Your Application Configuration

Update your config/index.ts file with the live mode values.

Obtaining Stripe API Keys

Before setting up your live webhook, you'll need to obtain your Stripe API keys for production use. These keys are essential for authenticating your requests to the Stripe API.

  1. Go to the Stripe API Keys page.

  2. You'll find two types of keys here:

    • Publishable key (starts with pk_live_)
    • Secret key (starts with sk_live_)
  3. Copy your live Publishable key and update it in your apps/web/.env.local file:

    NEXT_PUBLIC_STRIPE_PUBLIC_KEY=pk_live_your_live_publishable_key
  4. Copy your live Secret key and update it in your apps/web/.env.local file:

    STRIPE_SECRET_KEY=sk_live_your_live_secret_key

⚠️ Important: Never share your Secret key publicly or commit it to version control. Always use environment variables to store sensitive information.

  1. Make sure to update these keys in your production environment as well.