Files
firefrost-services/services/arbiter-3.0/.env.example
Claude (Chronicler #57) 4da6e21126 feat: Add Stripe direct integration to Trinity Console
WHAT WAS DONE:
- Created src/routes/stripe.js with 3 endpoints:
  * POST /stripe/create-checkout-session (dynamic mode: subscription or payment)
  * POST /stripe/webhook (signature verified, transaction-safe, idempotent)
  * POST /stripe/create-portal-session (Stripe Customer Portal access)
- Updated package.json to add stripe@^14.14.0 dependency
- Updated src/index.js to register Stripe routes (webhook BEFORE body parsers - critical!)
- Updated .env.example with STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, BASE_URL

WHY:
- Eliminates Paymenter dependency (Gemini-approved architecture)
- Handles both recurring subscriptions (tiers 2-9) and one-time payments (Awakened, Sovereign)
- Webhook processes 8 event types with full transaction safety
- Grace period system for failed payments (3-day countdown, auto-downgrade to Awakened)
- Chargeback = immediate permanent ban
- Idempotency protection via webhook_events_processed table

TECHNICAL DETAILS:
- Checkout dynamically switches mode based on billing_type (recurring vs one-time)
- Webhook uses BEGIN/COMMIT/ROLLBACK for all database operations
- Raw body parser for webhook signature verification (must come before express.json())
- Supports Stripe Customer Portal for self-service subscription management
- Handles both stripe_subscription_id and stripe_payment_intent_id correctly
- Grace period logic excludes lifetime users (is_lifetime = TRUE)

FILES CHANGED:
- services/arbiter-3.0/src/routes/stripe.js (new, 421 lines)
- services/arbiter-3.0/package.json (added stripe dependency)
- services/arbiter-3.0/src/index.js (registered stripe routes, webhook ordering)
- services/arbiter-3.0/.env.example (added Stripe env vars)

NEXT STEPS:
- Deploy to Command Center
- Add STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET to production .env
- Configure Stripe webhook endpoint in Dashboard
- Test end-to-end in test mode
- Switch to live mode for launch

Signed-off-by: Claude (Chronicler #57) <claude@firefrostgaming.com>
2026-04-03 15:27:01 +00:00

31 lines
861 B
Plaintext

# Discord Core
DISCORD_BOT_TOKEN=your_bot_token
GUILD_ID=your_guild_id
DISCORD_CLIENT_ID=your_client_id
DISCORD_CLIENT_SECRET=your_client_secret
# OAuth & Admin
REDIRECT_URI=https://discord-bot.firefrostgaming.com/auth/discord/callback
ADMIN_USERS=discord_id_1,discord_id_2
SESSION_SECRET=your_secure_session_secret
PORT=3500
NODE_ENV=production
# PostgreSQL Database
DB_USER=arbiter
DB_HOST=127.0.0.1
DB_NAME=arbiter_db
DB_PASSWORD=your_secure_password
DB_PORT=5432
# Pterodactyl Integration
PANEL_URL=https://panel.firefrostgaming.com
PANEL_CLIENT_KEY=ptlc_...
PANEL_APPLICATION_KEY=ptla_...
MINECRAFT_NEST_IDS=1,6,7
# Stripe Integration
STRIPE_SECRET_KEY=sk_test_... # or sk_live_... for production
STRIPE_WEBHOOK_SECRET=whsec_... # Get from Stripe Dashboard webhook settings
BASE_URL=https://discord-bot.firefrostgaming.com # For checkout redirect URLs