Implement full Stripe payment integration with 3-tier pricing, checkout flow, subscription management, and webhook handling.
Target: Individual professionals, solo practitioners
- Access to Alpha Deck (general ops)
- 100 AI interactions/month
- Voice & Vision modes (limited)
- Email support
- Basic analytics
Target: Active professionals, small practices
- All Basic features
- Access to Defense Deck (legal) OR Medical Deck (clinical)
- 500 AI interactions/month
- Unlimited Voice & Vision
- Priority support
- Advanced analytics
- Export capabilities
- MOST POPULAR
Target: Practices, organizations, power users
- All Pro features
- Access to ALL decks (Alpha, Defense, Medical)
- Unlimited AI interactions
- White-label options
- API access
- Dedicated support
- Custom integrations
- Team collaboration (up to 5 users)
- Install
stripeand@stripe/stripe-jspackages - Create
lib/stripe.tsfor server-side Stripe instance - Create
lib/stripe-client.tsfor client-side Stripe - Add Stripe keys to
.env.example - Document Stripe dashboard setup
-
Create
/api/stripe/checkout- Create Checkout Session- Accept:
priceId,userId(from session) - Return:
sessionIdfor redirect - Modes:
subscription(recurring)
- Accept:
-
Create
/api/stripe/portal- Customer Portal- Redirect to Stripe Customer Portal for:
- Cancel subscription
- Update payment method
- View invoices
- Download receipts
- Redirect to Stripe Customer Portal for:
-
Create
/api/stripe/webhook- Handle Stripe Events- Listen for:
checkout.session.completed - Listen for:
customer.subscription.created - Listen for:
customer.subscription.updated - Listen for:
customer.subscription.deleted - Listen for:
invoice.payment_failed - Update internal subscription state (localStorage for now, DB later)
- Listen for:
- Create
app/pricing/page.tsx - Design 3-column pricing table
- Add feature comparison matrix
- Add FAQ section
- Mobile-responsive design
- "Most Popular" badge on Pro tier
- "Start Free Trial" CTA (14 days)
- Social proof (testimonials from homepage)
- Create
lib/subscription.tsfor subscription checks - Add subscription context to terminal
- Update middleware to check subscription status
- Add "Upgrade" prompts when limits reached
- Create subscription state management:
interface Subscription { tier: 'free' | 'basic' | 'pro' | 'enterprise'; status: 'active' | 'canceled' | 'past_due' | 'trialing'; currentPeriodEnd: number; cancelAtPeriodEnd: boolean; usageThisMonth: { interactions: number; limit: number; }; }
- Create
components/BillingDashboard.tsx - Show current plan details
- Show usage this month (interactions)
- Show next billing date
- "Manage Subscription" button → Stripe Portal
- "Upgrade" button → Pricing page
- Invoice history
- Add interaction counter to terminal
- Persist count in localStorage (temporary)
- Show progress bar: "45/100 interactions this month"
- Block requests when limit reached (with upgrade prompt)
- Reset counter on new billing period
- Test checkout flow with Stripe test cards
- Test webhook events with Stripe CLI
- Test subscription upgrades/downgrades
- Test cancellation flow
- Test payment failure scenarios
- Verify security (no exposed keys, HTTPS only)
Add to .env.local:
# Stripe (get from https://dashboard.stripe.com/apikeys)
STRIPE_SECRET_KEY=sk_test_...your-secret-key...
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...your-publishable-key...
STRIPE_WEBHOOK_SECRET=whsec_...your-webhook-secret...
# Stripe Price IDs (create products in Stripe Dashboard first)
STRIPE_PRICE_BASIC=price_...basic-monthly...
STRIPE_PRICE_PRO=price_...pro-monthly...
STRIPE_PRICE_ENTERPRISE=price_...enterprise-monthly...- Go to https://stripe.com/
- Sign up for account
- Complete onboarding
- Switch to Test Mode (top right toggle)
Navigate to Products → Add Product
Product 1: DarkDeck Basic
- Name:
DarkDeck Basic - Description:
Individual professional plan with Alpha Deck access - Pricing:
$29.00 USD / month - Billing period:
Monthly - Copy the Price ID →
STRIPE_PRICE_BASIC
Product 2: DarkDeck Pro
- Name:
DarkDeck Pro - Description:
Professional plan with Defense or Medical Deck access - Pricing:
$99.00 USD / month - Billing period:
Monthly - Copy the Price ID →
STRIPE_PRICE_PRO
Product 3: DarkDeck Enterprise
- Name:
DarkDeck Enterprise - Description:
Enterprise plan with full access to all decks - Pricing:
$299.00 USD / month - Billing period:
Monthly - Copy the Price ID →
STRIPE_PRICE_ENTERPRISE
- Go to Developers → API Keys
- Copy Publishable key →
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY - Copy Secret key →
STRIPE_SECRET_KEY
- Go to Developers → Webhooks
- Add endpoint:
https://yourdomain.com/api/stripe/webhook - Select events:
checkout.session.completedcustomer.subscription.createdcustomer.subscription.updatedcustomer.subscription.deletedinvoice.payment_failed
- Copy Signing secret →
STRIPE_WEBHOOK_SECRET
- Go to Settings → Customer Portal
- Enable portal
- Configure:
- ✅ Cancel subscriptions
- ✅ Update payment methods
- ✅ View invoices
- ✅ Update billing details
Success: 4242 4242 4242 4242
Decline: 4000 0000 0000 0002
Requires Auth: 4000 0025 0000 3155
Expiry: Any future date
CVC: Any 3 digits
ZIP: Any 5 digits
# Install Stripe CLI
scoop install stripe
# Login
stripe login
# Forward webhooks to local server
stripe listen --forward-to localhost:3000/api/stripe/webhook
# This will give you a webhook secret starting with whsec_
# Add it to .env.local as STRIPE_WEBHOOK_SECRET- Start dev server:
pnpm dev - Go to
/pricing - Click "Subscribe" on any tier
- Use test card:
4242 4242 4242 4242 - Should redirect to success page
- Check Stripe Dashboard → Customers (should see new customer)
- Check webhook logs (should see
checkout.session.completed)
By end of Day 2, you should have:
- ✅ Working pricing page with 3 tiers
- ✅ Functional checkout flow
- ✅ Webhook handling for subscription events
- ✅ Subscription state management
- ✅ Usage tracking (interactions)
- ✅ Billing dashboard component
- ✅ Upgrade prompts when limits reached
- ✅ All tested with Stripe test mode
Revenue Potential (conservative estimates):
- 10 Basic subscribers: $290/month
- 30 Pro subscribers: $2,970/month
- 5 Enterprise subscribers: $1,495/month
- Total MRR: $4,755/month ($57,060/year)
Infrastructure Score Improvement:
- Payment Integration: 0/10 → 9/10
- Monetization: 0/10 → 8/10
- Business Model: 3/10 → 7/10
- Overall Score: 6.5/10 → 7.5/10
Starting with Phase 1: Stripe Setup...