Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ POSTGRES_DB=pollz_db
POSTGRES_USER=pollz_user
POSTGRES_PASSWORD=your-postgres-password-here

# GitHub API Configuration
# Add your GitHub Personal Access Token here
# Create one at: https://github.com/settings/tokens
# Required scopes: public_repo
GITHUB_TOKEN=your-github-token-here

# Google OAuth Client ID
REACT_APP_GOOGLE_CLIENT_ID=your-google-client-id-here

# Razorpay Configuration
RAZORPAY_KEY_ID=your-razorpay-key-id
RAZORPAY_KEY_SECRET=your-razorpay-key-secret
RAZORPAY_WEBHOOK_SECRET=your-razorpay-webhook-secret

# Server Configuration (optional)
# SERVER=False # Set to True for production
RAZORPAY_WEBHOOK_SECRET=your-razorpay-webhook-secret
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,67 @@ cp .env.example .env
# Edit .env with your credentials
```

### Razorpay Setup (Required for SuperChat payments)

1. **Get Razorpay API Keys:**
- Visit [Razorpay Dashboard](https://dashboard.razorpay.com/)
- Sign up/Login to your account
- Go to **Account & Settings** → **API Keys**
- Generate **Test Mode** keys for development
- Copy the **Key ID** and **Key Secret**

2. **Configure Razorpay in .env:**
```bash
RAZORPAY_KEY_ID=rzp_test_your_key_id_here
RAZORPAY_KEY_SECRET=your_key_secret_here
RAZORPAY_WEBHOOK_SECRET=your_custom_webhook_secret
```

3. **Setup Webhook for Local Development (using ngrok):**

**Install ngrok:**
```bash
# On macOS
brew install ngrok

# On Ubuntu/Debian
sudo apt install ngrok

# Or download from https://ngrok.com/download
```

**Expose your local server:**
```bash
# In a separate terminal, expose port 8000 (or your Django port)
ngrok http 8000
```

**Configure Razorpay Webhook:**
- Copy the ngrok HTTPS URL (e.g., `https://abc123.ngrok-free.app`)
- Go to [Razorpay Dashboard](https://dashboard.razorpay.com/) → **Webhooks**
- Click **Create Webhook**
- **URL:** `https://your-ngrok-url.ngrok-free.app/api/superchat/razorpay-webhook/`
- **Events:** Select `payment.captured`
- **Secret:** Use the same value as `RAZORPAY_WEBHOOK_SECRET` in your .env
- Click **Create**

**Update Django ALLOWED_HOSTS:**
```bash
# Add your ngrok domain to settings.py ALLOWED_HOSTS
ALLOWED_HOSTS = [
'localhost',
'127.0.0.1',
'your-ngrok-domain.ngrok-free.app', # Add this
]
```

4. **Test the Integration:**
- Start your Django server with Docker Compose
- Keep ngrok running in a separate terminal
- Test SuperChat payments through the frontend
- Check Razorpay Dashboard for payment status
- Verify webhook calls in ngrok terminal logs

3. **Run with Docker Compose**
```bash
docker-compose up --build
Expand Down
9 changes: 8 additions & 1 deletion pollz/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ["localhost", "127.0.0.1", "7ef3-103-144-93-205.ngrok-free.app","pollz.live", "www.pollz.live"]
ALLOWED_HOSTS = [
'localhost',
'127.0.0.1',
'fb788110f29a.ngrok-free.app', # Add your current ngrok domain
'*.ngrok-free.app', # Or use wildcard for any ngrok subdomain
'pollz.live',
'www.pollz.live'
]
CSRF_TRUSTED_ORIGINS = ["https://pollz.live", "http://pollz.live"]

CORS_ALLOW_CREDENTIALS = False
Expand Down