Files
aperonight/config/initializers/stripe.rb
kbe 4e2445198f feat: Implement complete event ticketing system with Stripe integration and email confirmations
- Enhanced events index page with improved visual design and better information display
- Completely redesigned event show page with modern layout, ticket selection, and checkout functionality
- Implemented Stripe payment processing for ticket purchases
- Created ticket generation system with PDF tickets and QR codes
- Added email confirmation system with ticket attachments
- Updated database configuration to use SQLite for easier development setup
- Fixed gem dependencies and resolved conflicts
- Improved error handling throughout the checkout process
- Enhanced Stimulus controller for ticket cart management
- Added proper redirect handling for successful and cancelled payments
2025-08-28 18:08:05 +02:00

27 lines
1.2 KiB
Ruby
Executable File

Rails.application.configure do
# Try to get Stripe keys from environment variables first, then from credentials
stripe_publishable_key = ENV["STRIPE_PUBLISHABLE_KEY"]
stripe_secret_key = ENV["STRIPE_SECRET_KEY"]
stripe_webhook_secret = ENV["STRIPE_WEBHOOK_SECRET"]
# If not in environment variables, try to get from credentials
if Rails.application.respond_to?(:credentials) && Rails.application.credentials.respond_to?(:stripe)
stripe_credentials = Rails.application.credentials.stripe
if stripe_credentials
stripe_publishable_key ||= stripe_credentials[:publishable_key] if stripe_credentials.key?(:publishable_key)
stripe_secret_key ||= stripe_credentials[:secret_key] if stripe_credentials.key?(:secret_key)
stripe_webhook_secret ||= stripe_credentials[:webhook_secret] if stripe_credentials.key?(:webhook_secret)
end
end
config.stripe = {
publishable_key: stripe_publishable_key,
secret_key: stripe_secret_key,
signing_secret: stripe_webhook_secret
}
end
# Only set the API key if it exists
if Rails.application.config.stripe[:secret_key].present?
Stripe.api_key = Rails.application.config.stripe[:secret_key]
end