83 lines
2.2 KiB
Markdown
83 lines
2.2 KiB
Markdown
|
|
# START HERE - Stripe Integration Guide
|
||
|
|
|
||
|
|
Welcome! Everything is ready. Just follow these simple steps.
|
||
|
|
|
||
|
|
## Quick Setup (23 Minutes Total)
|
||
|
|
|
||
|
|
### Step 1: Create Stripe Account (10 min)
|
||
|
|
1. Visit https://dashboard.stripe.com
|
||
|
|
2. Sign up with your email
|
||
|
|
3. Verify your email and complete setup
|
||
|
|
|
||
|
|
### Step 2: Get API Keys (3 min)
|
||
|
|
In Stripe Dashboard:
|
||
|
|
- Go to: Developers → API Keys
|
||
|
|
- Copy your Secret Key (starts with sk_test_)
|
||
|
|
- Copy your Publishable Key (starts with pk_test_)
|
||
|
|
|
||
|
|
### Step 3: Create Price Objects (5 min)
|
||
|
|
For each plan, go to Products → Create Product:
|
||
|
|
|
||
|
|
**Starter**: £39/month recurring
|
||
|
|
**Growth**: £99/month recurring
|
||
|
|
**Pro**: £249/month recurring
|
||
|
|
|
||
|
|
Copy each Price ID (starts with price_)
|
||
|
|
|
||
|
|
### Step 4: Create Webhook (2 min)
|
||
|
|
- Go to: Developers → Webhooks
|
||
|
|
- Endpoint URL: https://your-domain.com/api/billing/webhook
|
||
|
|
- Select: checkout.session.completed, customer.subscription.updated, customer.subscription.deleted, invoice.payment_failed
|
||
|
|
- Copy Signing Secret (starts with whsec_)
|
||
|
|
|
||
|
|
### Step 5: Update .env (2 min)
|
||
|
|
Edit /home/peter/tenderpilot/.env and update:
|
||
|
|
```
|
||
|
|
STRIPE_SECRET_KEY=your_secret_key_here
|
||
|
|
STRIPE_PUBLISHABLE_KEY=your_publishable_key_here
|
||
|
|
STRIPE_WEBHOOK_SECRET=your_webhook_secret_here
|
||
|
|
STRIPE_PRICE_STARTER=your_starter_price_id
|
||
|
|
STRIPE_PRICE_GROWTH=your_growth_price_id
|
||
|
|
STRIPE_PRICE_PRO=your_pro_price_id
|
||
|
|
```
|
||
|
|
|
||
|
|
### Step 6: Initialize Database (1 min)
|
||
|
|
```
|
||
|
|
node init-db.js
|
||
|
|
```
|
||
|
|
|
||
|
|
### Step 7: Test (5 min)
|
||
|
|
```
|
||
|
|
npm start
|
||
|
|
```
|
||
|
|
|
||
|
|
Test with: curl -X POST http://localhost:3456/api/billing/checkout ...
|
||
|
|
|
||
|
|
## Documentation Files
|
||
|
|
|
||
|
|
- **README_STRIPE.md** - Overview and quick reference
|
||
|
|
- **STRIPE_SETUP.md** - Complete setup guide (read this!)
|
||
|
|
- **BILLING_API_EXAMPLES.md** - API testing examples
|
||
|
|
- **STRIPE_INTEGRATION_SUMMARY.md** - Architecture details
|
||
|
|
- **CHANGES.md** - Complete changelog
|
||
|
|
|
||
|
|
## What Was Built
|
||
|
|
|
||
|
|
✅ 4 API endpoints for billing
|
||
|
|
✅ Stripe Checkout integration
|
||
|
|
✅ Webhook event processing
|
||
|
|
✅ Subscription database table
|
||
|
|
✅ Access control middleware
|
||
|
|
✅ JWT authentication
|
||
|
|
✅ Comprehensive documentation
|
||
|
|
|
||
|
|
## Next Action
|
||
|
|
|
||
|
|
1. Open: README_STRIPE.md
|
||
|
|
2. Follow: STRIPE_SETUP.md
|
||
|
|
3. Test: BILLING_API_EXAMPLES.md
|
||
|
|
|
||
|
|
Total setup time: ~23 minutes
|
||
|
|
|
||
|
|
Questions? Check the documentation files or Stripe's official guides.
|