diff --git a/docs/features/subscription-billing.md b/docs/features/subscription-billing.md index 817a8fd7..a291cb68 100644 --- a/docs/features/subscription-billing.md +++ b/docs/features/subscription-billing.md @@ -169,9 +169,60 @@ Required environment variables: STRIPE_SECRET_KEY=sk_test_... STRIPE_PUBLISHABLE_KEY=pk_test_... STRIPE_WEBHOOK_SECRET=whsec_... -STRIPE_TRIAL_DAYS=14 # Optional, default trial period +STRIPE_TRIAL_DAYS=30 # Optional, default trial period ``` +### Setup Guide + +#### Step 1: Get API Keys + +1. Go to [Stripe Dashboard](https://dashboard.stripe.com/apikeys) +2. Copy your **Publishable key** (`pk_test_...` or `pk_live_...`) +3. Copy your **Secret key** (`sk_test_...` or `sk_live_...`) + +#### Step 2: Create Webhook Endpoint + +1. Go to [Stripe Webhooks](https://dashboard.stripe.com/webhooks) +2. Click **Add endpoint** +3. Enter your endpoint URL: `https://yourdomain.com/api/v1/webhooks/stripe` +4. Select events to listen to: + - `checkout.session.completed` + - `customer.subscription.created` + - `customer.subscription.updated` + - `customer.subscription.deleted` + - `invoice.paid` + - `invoice.payment_failed` +5. Click **Add endpoint** +6. Copy the **Signing secret** (`whsec_...`) - this is your `STRIPE_WEBHOOK_SECRET` + +#### Step 3: Local Development with Stripe CLI + +For local testing, use the [Stripe CLI](https://stripe.com/docs/stripe-cli): + +```bash +# Install Stripe CLI +brew install stripe/stripe-cli/stripe # macOS +# or download from https://github.com/stripe/stripe-cli/releases + +# Login to Stripe +stripe login + +# Forward webhooks to your local server +stripe listen --forward-to localhost:8000/api/v1/webhooks/stripe + +# The CLI will display a webhook signing secret (whsec_...) +# Use this as STRIPE_WEBHOOK_SECRET for local development +``` + +#### Step 4: Create Products & Prices in Stripe + +Create subscription products for each tier: + +1. Go to [Stripe Products](https://dashboard.stripe.com/products) +2. Create products for each tier (Starter, Professional, Business, Enterprise) +3. Add monthly and annual prices for each +4. Copy the Price IDs (`price_...`) and update your tier configuration + ### Webhook Events The system handles these Stripe events: