A self-hosted UPI & COD payment gateway with zero per-transaction platform fees, universal JavaScript checkout integration, dynamic QR payments, WhatsApp OTP authentication, and automated payment verification.
JavaScript
# YOUPI PG - Environment Configuration Template
# ============================================================
# Copy this file to .env and configure for your deployment.
# NEVER commit .env with real secrets to version control.
# ============================================================
# --- NODE ENVIRONMENT ---
# NODE_ENV is managed by the supervisor: 'production' by `npm start`, 'development' by `npm run dev`.
# NODE_ENV=development
# --- VERCEL SERVICES ---
# Vercel injects the following service-binding URLs at runtime. Do not set
# these variables yourself in Vercel; they are declared in vercel.json.
# PAYMENT_API_URL=
# CHECKOUT_PORTAL_URL=
# CONTROL_CENTER_URL=
# GMAIL_OBSERVER_URL=
# SMS_OBSERVER_URL=
# Optional custom public origin used when payment-api returns checkout links.
# CHECKOUT_PUBLIC_URL=https://your-domain.example
# --- SERVICE PORTS (Strictly Non-Docker Standard Host Topology) ---
CONTROL_CENTER_PORT=8090
PAYMENT_API_PORT=6100
CHECKOUT_PORTAL_PORT=7000
MERCHANT_ADMIN_PORT=6001
HELP_PORTAL_PORT=3000
GMAIL_OBSERVER_PORT=6003
SMS_OBSERVER_PORT=6002
COIN_WALLET_STORE_PORT=5000
# --- PUBLIC SERVICE URLS ---
BASE_PAYMENT_API_URL=http://localhost:6100
BASE_CHECKOUT_URL=http://localhost:7000
BASE_ADMIN_URL=http://localhost:6001
BASE_HELP_URL=http://localhost:3000
BASE_DEMO_STORE_URL=http://localhost:5000
# Merchant sites allowed to show the checkout in the youpi.js modal (iframe), comma separated.
# Unset = only the portal's own origin may frame it.
# Origins allowed to call browser-facing gateway APIs. Set only trusted storefront origins.
YOUPI_ALLOWED_ORIGINS=https://shop.example.com
# Return URL origins accepted when a server creates a payment session.
YOUPI_ALLOWED_RETURN_ORIGINS=https://shop.example.com
# --- DATABASE CONFIGURATION ---
# PostgreSQL connection string:
# DATABASE_URL=postgresql://YOUR_USER:YOUR_PASSWORD@YOUR_HOST:5432/youpi_pg
# SQLite local file fallback for instant zero-dependency testing:
USE_SQLITE_FALLBACK=true
SQLITE_DB_PATH=./data/youpi_pg.sqlite
# --- CRYPTOGRAPHIC SECRETS (Generate using crypto.randomBytes(32).toString('hex')) ---
# Master 256-bit encryption key for sensitive records (OAuth tokens, device keys):
# By default a random key is generated and saved under data/.secrets/.
# For managed deployments set a stable, strong key OUTSIDE version control.
# ENCRYPTION_MASTER_KEY=YOUR_GENERATED_64_HEX_CHAR_KEY
# Session & JWT secret:
# Do not deploy a shared or published JWT signing secret.
# JWT_SECRET=YOUR_LONG_RANDOM_SECRET
# Default Admin credentials for initial setup:
# The service authenticates API administration with ADMIN_API_TOKEN.
# It generates a random persisted token by default. Do not ship default passwords.
# ADMIN_API_TOKEN=YOUR_RANDOM_64_HEX_CHAR_TOKEN
# INITIAL_ADMIN_EMAIL=YOUR_ADMIN_EMAIL
# INITIAL_ADMIN_PASSWORD=YOUR_UNIQUE_STRONG_PASSWORD
# --- TIMING & QUEUE ENGINE CONSTANTS ---
# Payment active window (milliseconds, default 5 minutes = 300000):
PAYMENT_ACTIVE_WINDOW_MS=300000
# Payment processing verification window (milliseconds, default 30 seconds = 30000):
PAYMENT_PROCESSING_WINDOW_MS=30000
# Late observation grace evaluation window (milliseconds, default 30 minutes = 1800000):
LATE_OBSERVATION_WINDOW_MS=1800000
# --- GMAIL OBSERVER CONFIGURATION ---
GMAIL_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
GMAIL_CLIENT_SECRET=your-google-client-secret
GMAIL_REDIRECT_URI=http://localhost:6003/oauth/callback
GMAIL_POLL_INTERVAL_MS=5000
# --- SMS / GOOGLE MESSAGES OBSERVER ---
SMS_OBSERVER_POLL_INTERVAL_MS=3000
# --- ANDROID OBSERVER SECURITY ---
ANDROID_ENROLLMENT_SECRET=android_pairing_enrollment_secret_key_32_chars
ANDROID_HEARTBEAT_TIMEOUT_MS=180000
# --- WEBHOOK ENGINE ---
# Minimum 2 attempts; keep receiver idempotent using X-Gateway-Delivery-Id.
WEBHOOK_MAX_RETRIES=5
WEBHOOK_RETRY_INTERVAL_MS=5000
WEBHOOK_INITIAL_BACKOFF_MS=5000
# --- CHECKOUT PORTAL FRAMING ---
# frame-ancestors CSP for the checkout page. Unset defaults to * in development
# and 'self' in production (NODE_ENV=production or YOUPI_MODE=production); pin
# it to your storefront origins to prevent clickjacking.
# Origins allowed to frame the checkout page (comma or space separated).
# Only bare http(s) origins are accepted; anything else is ignored.
# CHECKOUT_FRAME_ANCESTORS=https://shop.example.com
# --- WHITE-LABEL BRANDING & PLATFORM DEFAULTS ---
# Global default application name displayed on checkout, admin, and receipts:
DEFAULT_APP_NAME="YOUPI PG"
# Primary brand theme color (hex code):
DEFAULT_PRIMARY_COLOR="#2563eb"
# Default platform customer support email:
DEFAULT_SUPPORT_EMAIL="[email protected]"
# Default platform customer support phone:
DEFAULT_SUPPORT_PHONE="9876543210"
# Vercel Services inject these URLs at runtime from the bindings in vercel.json.
# Do not set PAYMENT_API_URL, CHECKOUT_PORTAL_URL, CONTROL_CENTER_URL,
# GMAIL_OBSERVER_URL, or SMS_OBSERVER_URL manually in Vercel.
# Default logo image URL (leave empty for dynamic shield monogram):
# DEFAULT_LOGO_URL=https://example.com/logo.png
# Default trust badge text (defaults to "${DEFAULT_APP_NAME} Verified Business"):
# DEFAULT_TRUST_BADGE_TEXT="YOUPI PG Verified Business"
# Default footer guarantee (defaults to "100% Payment Protection by ${DEFAULT_APP_NAME}"):
# DEFAULT_FOOTER_GUARANTEE="100% Payment Protection by YOUPI PG"
# Completely hide "Powered by" branding from checkout portal (true/false):
# DEFAULT_HIDE_POWERED_BY=false
# WhatsApp OTP notification sender / brand signature:
# WHATSAPP_SENDER_NAME="YOUPI PG"
# Default seeded merchant business name:
# DEFAULT_MERCHANT_NAME="YOUPI Demo Store"
# DEFAULT_MERCHANT_SLUG="demo-store"
# --- CUSTOMIZED PAYMENT QR STAND CONFIGURATION ---
# Default Payee UPI ID (VPA) for payment stand generation:
# DEFAULT_PAYEE_VPA="merchant@ybl"
# Merchant PhonePe registered mobile number for observer verification and stand display:
# PHONEPE_REGISTERED_MOBILE="9876543210"