Files
tenderpilot/QUICK_START.md

148 lines
3.6 KiB
Markdown
Raw Normal View History

# TenderRadar Stripe - Quick Start Guide
## ✅ What's Already Done
The entire Stripe integration is **complete and running**:
- ✅ Code implemented (stripe-billing.js, middleware, server routes)
- ✅ Database schema created (subscriptions table)
- ✅ Server running on port 3456
- ✅ All endpoints registered and tested
---
## 🎯 What You Need to Do (5 Steps)
### 1. Create Stripe Account
Go to: https://dashboard.stripe.com and sign up
### 2. Get API Keys
In Stripe Dashboard:
- Click **Developers****API Keys**
- Copy **Secret Key** (starts with `sk_test_`)
- Copy **Publishable Key** (starts with `pk_test_`)
### 3. Create 3 Price Objects
In Stripe Dashboard:
- Click **Products****+ Add product**
Create these 3 products:
**Product 1:**
- Name: `TenderRadar Starter`
- Price: `39.00 GBP`
- Billing: `Monthly`
- → Copy the **Price ID** (starts with `price_`)
**Product 2:**
- Name: `TenderRadar Growth`
- Price: `99.00 GBP`
- Billing: `Monthly`
- → Copy the **Price ID**
**Product 3:**
- Name: `TenderRadar Pro`
- Price: `249.00 GBP`
- Billing: `Monthly`
- → Copy the **Price ID**
### 4. Set Up Webhook
In Stripe Dashboard:
- Click **Developers****Webhooks****+ Add endpoint**
- URL: `https://your-domain.com/api/billing/webhook`
- Events: Select all 4:
- `checkout.session.completed`
- `customer.subscription.updated`
- `customer.subscription.deleted`
- `invoice.payment_failed`
- → Copy the **Signing Secret** (starts with `whsec_`)
### 5. Update .env File
SSH into your server:
```bash
ssh -p 22022 peter@75.127.4.250
cd /home/peter/tenderpilot
nano .env
```
Replace these lines with your real keys:
```env
STRIPE_SECRET_KEY=sk_test_YOUR_ACTUAL_KEY
STRIPE_PUBLISHABLE_KEY=pk_test_YOUR_ACTUAL_KEY
STRIPE_WEBHOOK_SECRET=whsec_YOUR_ACTUAL_SECRET
STRIPE_PRICE_STARTER=price_YOUR_STARTER_PRICE_ID
STRIPE_PRICE_GROWTH=price_YOUR_GROWTH_PRICE_ID
STRIPE_PRICE_PRO=price_YOUR_PRO_PRICE_ID
```
Save and restart server:
```bash
pkill -f 'node.*server.js'
npm start &
```
---
## 🧪 Test It
### Register a test user:
```bash
curl -X POST http://localhost:3456/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"password": "testpass123",
"company_name": "Test Co"
}'
```
Save the returned `token`.
### Create a checkout session:
```bash
curl -X POST http://localhost:3456/api/billing/checkout \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"plan": "starter",
"successUrl": "http://localhost:3000/success",
"cancelUrl": "http://localhost:3000/cancel"
}'
```
Open the returned `url` in your browser and use test card:
- Card: `4242 4242 4242 4242`
- Expiry: Any future date
- CVC: Any 3 digits
---
## 📚 Full Documentation
For detailed setup instructions, see:
- **STRIPE_PRICE_SETUP_GUIDE.md** — Step-by-step Stripe dashboard guide
- **IMPLEMENTATION_COMPLETE.md** — Full implementation summary
- **BILLING_API_EXAMPLES.md** — API testing examples
- **STRIPE_SETUP.md** — Complete integration overview
All files are in `/home/peter/tenderpilot/` on your VPS.
---
## 🚨 Important Notes
1. **Start in Test Mode** — Use test keys first (sk_test_, pk_test_)
2. **HTTPS Required for Production** — Webhooks need HTTPS in live mode
3. **Don't Commit .env** — Keep your keys private
4. **Trial Period** — All subscriptions automatically get 14 days free
---
## ✅ That's It!
Once you update the `.env` file with real Stripe keys, everything will work.
**Questions?** Read the detailed docs listed above.
**Status:** Server is running and waiting for your Stripe keys ✅