All checks were successful
Build and Push Docker Images / docker (push) Successful in 1m22s
CRITICAL SECURITY FIXES: - Add webhook secret validation to prevent signature bypass - Implement idempotency protection across all webhook handlers - Add atomic database updates to prevent race conditions - Improve CORS security with origin validation and logging - Remove .env from git tracking to protect secrets STRIPE INTEGRATION: - Add support for checkout.session.expired webhook event - Add Stripe publishable key to environment configuration - Fix webhook handlers with proper idempotency checks - Update Order model with atomic updatePaymentAndStatus method - Add comprehensive logging for webhook processing DEPLOYMENT ARCHITECTURE: - Split into two Docker images (frontend-latest, backend-latest) - Update CI/CD to build separate frontend and backend images - Configure backend on port 3801 (internal 3001) - Add production-ready docker-compose.yml - Remove redundant docker-compose.portainer.yml - Update nginx configuration for both frontend and backend DOCUMENTATION: - Add PRODUCTION-SETUP.md with complete deployment guide - Add docs/stripe-security-fixes.md with security audit details - Add docs/stripe-checkout-sessions.md with integration docs - Add docs/stripe-webhooks.md with webhook configuration - Update .env.example with all required variables including Stripe publishable key CONFIGURATION: - Consolidate to single .env.example template - Update .gitignore to protect all .env variants - Add server/Dockerfile for backend container - Update DEPLOYMENT.md with new architecture 🔒 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
24 lines
681 B
JavaScript
24 lines
681 B
JavaScript
import Stripe from 'stripe';
|
|
|
|
// Validate required environment variables
|
|
if (!process.env.STRIPE_SECRET_KEY) {
|
|
throw new Error('STRIPE_SECRET_KEY environment variable is required');
|
|
}
|
|
|
|
if (!process.env.STRIPE_WEBHOOK_SECRET) {
|
|
throw new Error('STRIPE_WEBHOOK_SECRET environment variable is required');
|
|
}
|
|
|
|
// Initialize Stripe with secret key
|
|
export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY, {
|
|
apiVersion: '2025-10-29.clover',
|
|
});
|
|
|
|
// Webhook configuration - validated on startup
|
|
export const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET;
|
|
|
|
console.log('✅ Stripe client initialized');
|
|
console.log('✅ Webhook secret configured');
|
|
|
|
export default stripe;
|