- Add .env.example file for environment variable setup - Add .gitignore to manage sensitive files and directories - Add Dockerfile.prod for production-ready Docker image - Add PRODUCTION_CHECKLIST.md for pre/post deployment steps - Add PRODUCTION_DEPLOYMENT.md for deployment instructions - Add STRIPE_SETUP.md for Stripe payment configuration - Add config/default.toml for default configuration settings - Add config/local.toml.example for local configuration template
2.8 KiB
Stripe Integration Setup Guide
This guide explains how to configure Stripe payment processing for the company registration system.
🔧 Configuration Options
The application supports multiple ways to configure Stripe API keys:
1. Configuration Files (Recommended for Development)
Default Configuration
The application includes default test keys in config/default.toml
:
[stripe]
publishable_key = "pk_test_..."
secret_key = "sk_test_..."
Local Configuration
Create config/local.toml
to override defaults:
[stripe]
publishable_key = "pk_test_YOUR_KEY_HERE"
secret_key = "sk_test_YOUR_KEY_HERE"
webhook_secret = "whsec_YOUR_WEBHOOK_SECRET"
2. Environment Variables (Recommended for Production)
Set environment variables with the APP__
prefix:
export APP__STRIPE__PUBLISHABLE_KEY="pk_test_YOUR_KEY_HERE"
export APP__STRIPE__SECRET_KEY="sk_test_YOUR_KEY_HERE"
export APP__STRIPE__WEBHOOK_SECRET="whsec_YOUR_WEBHOOK_SECRET"
Or create a .env
file:
APP__STRIPE__PUBLISHABLE_KEY=pk_test_YOUR_KEY_HERE
APP__STRIPE__SECRET_KEY=sk_test_YOUR_KEY_HERE
APP__STRIPE__WEBHOOK_SECRET=whsec_YOUR_WEBHOOK_SECRET
🔑 Getting Your Stripe Keys
Test Keys (Development)
- Go to Stripe Dashboard
- Copy your Publishable key (starts with
pk_test_
) - Copy your Secret key (starts with
sk_test_
)
Live Keys (Production)
- Go to Stripe Dashboard
- Copy your Publishable key (starts with
pk_live_
) - Copy your Secret key (starts with
sk_live_
)
⚠️ Never commit live keys to version control!
🔒 Security Best Practices
-
Never commit sensitive keys - Use
.gitignore
to exclude:.env
config/local.toml
config/production.toml
-
Use test keys in development - Test keys are safe and don't process real payments
-
Use environment variables in production - More secure than config files
-
Rotate keys regularly - Generate new keys periodically
🚀 Quick Start
-
Copy the example files:
cp config/local.toml.example config/local.toml cp .env.example .env
-
Add your Stripe test keys to either file
-
Start the application:
cargo run
-
Test the payment flow at
http://127.0.0.1:9999/company
📋 Configuration Priority
The application loads configuration in this order (later overrides earlier):
- Default values in code
config/default.toml
config/local.toml
- Environment variables
🔍 Troubleshooting
- Keys not working? Check the Stripe Dashboard for correct keys
- Webhook errors? Ensure webhook secret matches your Stripe endpoint
- Configuration not loading? Check file paths and environment variable names