Stripe Setup Guide

Configure recurring payments for your subscription platform

1
Create a Stripe Account

Sign up for a Stripe account at stripe.com

Note: You'll start in test mode by default, which is perfect for development. You can switch to live mode later.

2
Get Your API Keys
  1. Go to Developers → API keys
  2. Copy your Publishable key (starts with pk_test_)
  3. Copy your Secret key (starts with sk_test_)

⚠️ Keep your secret key safe!

Never share your secret key or commit it to version control. It should only be stored in environment variables.

Add these to your app secrets:

STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_SECRET_KEY=sk_test_...
3
Create Subscription Products

Create recurring price IDs for each subscription tier:

  1. Go to Products → Add product
  2. Create three products: Silver, Gold, and Platinum
  3. For each product, set a recurring price (monthly)
  4. Copy each price ID (starts with price_)

Silver Plan

$75/month

Price ID: price_...

Gold Plan

$125/month

Price ID: price_...

Platinum Plan

$200/month

Price ID: price_...

Add price IDs to environment variables:

STRIPE_PRICE_ID_SILVER=price_...
STRIPE_PRICE_ID_GOLD=price_...
STRIPE_PRICE_ID_PLATINUM=price_...
4
Configure Webhooks

Set up webhooks to receive real-time updates about subscriptions:

  1. Go to Developers → Webhooks
  2. Click "Add endpoint"
  3. Enter your endpoint URL: https://your-domain.com/api/stripe-webhook
  4. Select these events to listen for:
    • invoice.payment_succeeded
    • invoice.payment_failed
    • customer.subscription.updated
    • customer.subscription.deleted
  5. Copy the webhook signing secret (starts with whsec_)

Add to your secrets:

STRIPE_WEBHOOK_SECRET=whsec_...
5
Test Your Integration

Use Stripe's test cards to verify your integration:

✅ Successful Payment

4242 4242 4242 4242

Any future expiry, any CVC

❌ Failed Payment

4000 0000 0000 0002

Card will be declined

Before going live: Switch from test mode to live mode in your Stripe dashboard and update all API keys and price IDs with live versions.

Quick Reference
Stripe Dashboard: dashboard.stripe.com
Documentation: Subscriptions Guide