A complete, enterprise-grade payment system for handling three product tiers with automatic digital product delivery.
✓ Three product tiers (Starter, Professional, Enterprise) ✓ Stripe payment integration ✓ Automated email notifications (SMTP) ✓ Telegram notifications for admin ✓ Secure download links with expiration ✓ Database tracking for orders and downloads ✓ Professional PDF product files ✓ Admin dashboard and statistics
- Self-Guided Growth Kit
- Core strategy playbook
- Setup guide
- Email support
- Everything in Starter
- 1-on-1 consultation
- Advanced documentation
- 30-day priority support
- Everything in Professional
- Global infrastructure deployment
- Dedicated account manager
- 24/7 support
Copy .env.example to .env and fill in your values:
cp .env.example .envRequired configurations:
STRIPE_SECRET_KEY- Your Stripe secret keySTRIPE_PUBLISHABLE_KEY- Your Stripe publishable keySTRIPE_WEBHOOK_SECRET- Your Stripe webhook secretSMTP_PASSWORD- Email password (already configured)TELEGRAM_BOT_TOKEN- Telegram bot token (already configured)TELEGRAM_CHAT_ID- Admin Telegram chat IDJWT_SECRET- Secret key for JWT tokensBASE_URL- Base URL for download links
npm installnode scripts/generate-products.jsThis will create:
guide.pdf(Starter kit)course.pdf(Professional course)deployment-guide.pdf(Enterprise guide)- Professional and enterprise resource zips
Development:
npm run devProduction:
npm startGET /api/payment/products- Get all productsPOST /api/payment/create-intent- Create Stripe payment intentPOST /api/payment/webhook- Stripe webhook
GET /api/download/info/:token- Get download infoGET /api/download/file/:token- Download filePOST /api/download/resend/:token- Resend download link
GET /api/admin/orders- Get all ordersGET /api/admin/orders/:orderId- Get order detailsGET /api/admin/stats- Get statistics
- Go to Stripe Dashboard
- Developers → Webhooks
- Add endpoint:
https://your-domain.com/api/payment/webhook - Select events:
payment_intent.succeeded
- Copy the signing secret to
STRIPE_WEBHOOK_SECRET
SQLite database is automatically created at ./database/pay.db
Tables:
products- Product informationorders- Customer ordersdownloads- Download links and trackingaccess_logs- Download access logs
Product files are stored in /home/ubuntu/pay/products/
guide.pdf- Starter kitcourse.pdf- Professional coursedeployment-guide.pdf- Enterprise guideprofessional-resources.zip- Professional resourcesenterprise-resources.zip- Enterprise resources
SMTP Settings:
- Host:
mail.privateemail.com - Port:
465(SSL/TLS) - User:
support@xiaofenghome.com - Password: Configured in .env
Emails sent:
- Order confirmation to customer with download link
- Admin notification with order details
Admin receives Telegram notifications for each new order with:
- Customer name
- Product purchased
- Amount paid
- Order ID
✓ Secure download tokens with expiration ✓ HTTPS enforcement ✓ Input validation ✓ Helmet.js for security headers ✓ CORS protection ✓ Stripe webhook signature verification ✓ JWT for token-based access ✓ Environment variable protection
- Node.js 14+
- npm or yarn
- Stripe account
- SMTP credentials
- Telegram bot token
- Clone repository
- Install dependencies:
npm install - Configure
.envfile - Generate product files:
node scripts/generate-products.js - Start server:
npm start - Configure Stripe webhook
- Set up domain SSL certificate
Email: support@xiaofenghome.com
MIT