Skip to main content
Glama
PHASE_5_COMPLETE.mdβ€’6.67 kB
# βœ… Phase 5 Complete - Stripe Billing Integration **Date**: October 13, 2025 **Status**: Core Billing Features Complete | Ready for Stripe Product Configuration --- ## πŸŽ‰ What We Accomplished ### Stripe Integration 1. **Environment Configuration** βœ… - Added your real Stripe test keys to both `.env` files - Configured publishable key for frontend: `pk_test_51SHfJ4DWv...` - Configured secret key for backend: `sk_test_51SHfJ4DWv...` 2. **Backend Services** βœ… - Created `/src/services/stripe_service.py` with full customer and subscription management - Installed Stripe Python SDK (`uv add stripe`) - Implemented: - Customer creation - Subscription management - Billing portal session creation - Subscription cancellation 3. **Database Schema** βœ… - Migration: `20251013000009_add_stripe_customer_id.sql` - Added `stripe_customer_id` column to `organizations` table - Added index for fast lookups 4. **Frontend Integration** βœ… - Installed Stripe SDK in Next.js (`npm install stripe`) - Created `/app/(dashboard)/billing/` with: - `actions.ts` - Server Actions for billing operations - `page.tsx` - Beautiful billing UI with pricing tiers 5. **Automatic Customer Creation** βœ… - Modified signup flow in `/app/(auth)/actions.ts` - Stripe customer automatically created when user signs up - Customer ID saved to database - **Verified Working**: Test signup created customer `cus_TE7nMW993LddKA` --- ## βœ… Verified Working Features **Signup Flow with Stripe** βœ… - User creates account β†’ Supabase user created - Organization automatically created - **Stripe customer automatically created** - Customer ID saved to database - Organization member with owner role created **Billing Dashboard** βœ… - Beautiful three-tier pricing display: - **Free**: $0/month (current plan) - **Pro**: $29/month - **Enterprise**: $99/month - Feature lists for each tier - Subscribe buttons for paid plans - Stripe checkout integration ready - Billing portal integration ready **Multi-Tenant Security** βœ… - Organization-scoped Stripe customers - RLS policies protecting billing data - Service role for privileged operations --- ## πŸ“Š Progress Update **Phase 5 Tasks**: 7/11 completed (64%) **Completed**: - βœ… Stripe test keys configuration - βœ… Stripe SDK installation (Python + Node.js) - βœ… Stripe service module creation - βœ… Database migration (stripe_customer_id) - βœ… Automatic customer creation on signup - βœ… Billing UI with pricing tiers - βœ… Billing portal integration (code ready) **Remaining** (requires Stripe Dashboard configuration): - ⏳ Create actual Stripe Products in dashboard - ⏳ Create Stripe Prices for each tier - ⏳ Configure webhook endpoints - ⏳ Test full checkout flow --- ## 🎨 Billing Page Features The billing page (`/billing`) displays: ### No Subscription (Current State) - Three pricing tier cards with features - Subscribe buttons for Pro and Enterprise - Current Plan indicator for Free tier ### With Active Subscription - Current subscription details card showing: - Plan name - Status badge (active/canceled) - Monthly amount - Cancellation notice (if applicable) - "Manage Subscription" button β†’ opens Stripe billing portal ### Server Actions Available 1. `createBillingPortalSession()` - Opens Stripe customer portal 2. `createCheckoutSession(priceId)` - Starts subscription checkout 3. `getSubscriptionStatus()` - Fetches current subscription info --- ## πŸ”§ Next Steps: Stripe Dashboard Configuration To enable full billing functionality: ### 1. Create Products in Stripe Dashboard Navigate to: https://dashboard.stripe.com/test/products **Pro Plan**: - Name: "Hostaway MCP Pro" - Description: "Professional plan with 10K API requests/month" - Pricing: $29/month recurring - Copy the Price ID (starts with `price_`) **Enterprise Plan**: - Name: "Hostaway MCP Enterprise" - Description: "Enterprise plan with unlimited requests" - Pricing: $99/month recurring - Copy the Price ID (starts with `price_`) ### 2. Update Environment Variables Add to `/dashboard/.env.local`: ```env STRIPE_PRO_PRICE_ID=price_xxxxxxxxxxxxx STRIPE_ENTERPRISE_PRICE_ID=price_xxxxxxxxxxxxx ``` ### 3. Configure Webhook Endpoint 1. In Stripe Dashboard β†’ Developers β†’ Webhooks 2. Add endpoint: `http://localhost:3001/api/webhooks/stripe` (or your production URL) 3. Select events: - `customer.subscription.created` - `customer.subscription.updated` - `customer.subscription.deleted` - `invoice.payment_succeeded` - `invoice.payment_failed` 4. Copy webhook signing secret 5. Add to `.env.local`: `STRIPE_WEBHOOK_SECRET=whsec_xxxxx` ### 4. Create Webhook Handler (Next Task) Will create `/app/api/webhooks/stripe/route.ts` to handle subscription events. --- ## πŸ§ͺ Test Account **Email**: billing-test@example.com **Password**: Password123! **Organization**: Example Organization **Stripe Customer ID**: cus_TE7nMW993LddKA **Role**: owner --- ## πŸ“ File Structure ### Backend (Python) ``` src/services/ β”œβ”€β”€ stripe_service.py # New - Stripe operations β”œβ”€β”€ credential_service.py # Existing - Vault encryption └── supabase_client.py # Existing - DB client ``` ### Frontend (Next.js) ``` app/ β”œβ”€β”€ (auth)/ β”‚ β”œβ”€β”€ actions.ts # Modified - adds Stripe customer on signup β”‚ β”œβ”€β”€ login/page.tsx β”‚ └── signup/page.tsx └── (dashboard)/ β”œβ”€β”€ billing/ β”‚ β”œβ”€β”€ actions.ts # New - Server Actions β”‚ └── page.tsx # New - Billing UI β”œβ”€β”€ settings/page.tsx └── api-keys/page.tsx ``` ### Database ``` supabase/migrations/ └── 20251013000009_add_stripe_customer_id.sql # New ``` --- ## πŸš€ Services Still Running - **Next.js Dashboard**: http://localhost:3001 βœ… - **FastAPI Backend**: http://localhost:8000 βœ… - **Supabase Local**: http://127.0.0.1:54321 βœ… --- ## πŸ’‘ Quick Test Commands ### View Stripe Customers ```bash # In database psql postgresql://postgres:postgres@127.0.0.1:54322/postgres -c \ "SELECT name, stripe_customer_id FROM organizations;" ``` ### Test Billing Page ```bash # 1. Login as test user open http://localhost:3001/login # 2. Navigate to billing open http://localhost:3001/billing # 3. View pricing tiers and subscription status ``` ### Check Stripe Dashboard ```bash # View test customers open https://dashboard.stripe.com/test/customers ``` --- **Phase 5 Core Features: Complete! πŸŽ‰** **Next Phase**: Webhook implementation and end-to-end billing testing.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/darrentmorgan/hostaway-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server