This commit is contained in:
root
2025-12-20 19:00:42 +01:00
parent 9871289bfb
commit e1a0966dee
23 changed files with 1878 additions and 48 deletions

View File

@@ -23,6 +23,22 @@ DB_PORT=3306
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=cbd420
# NOWPayments Configuration
# For testnet/sandbox testing:
NOWPAYMENTS_TESTNET=true
NOWPAYMENTS_SANDBOX_API_KEY=your_sandbox_api_key_here
NOWPAYMENTS_CURRENCY=usd # Sandbox doesn't support CHF, use USD or other supported currency
# For production:
# NOWPAYMENTS_TESTNET=false
# NOWPAYMENTS_API_KEY=your_production_api_key_here
# NOWPAYMENTS_CURRENCY=chf # Default is CHF for production
# IPN Callback URL (your external Node.js service that handles IPN callbacks)
IPN_CALLBACK_URL=http://your-ipn-service.com/api/payments/ipn-callback
# Base URL for success/cancel redirects (use your domain in production)
NEXT_PUBLIC_BASE_URL=http://localhost:3420
```
### Installation
@@ -57,11 +73,52 @@ Access the admin panel at `/admin` to:
- **Product Image**: Optional product image upload (JPEG, PNG, WebP, max 5MB)
3. Click "Create Drop"
## Payment Integration (NOWPayments)
### Testnet/Sandbox Setup
1. **Create a Sandbox Account**: Register at [https://sandbox.nowpayments.io/](https://sandbox.nowpayments.io/)
2. **Generate Sandbox API Key**:
- Log in to your sandbox dashboard
- Navigate to **Settings** > **Payments** > **API keys**
- Generate a test API key
3. **Configure Environment Variables**:
```env
NOWPAYMENTS_TESTNET=true
NOWPAYMENTS_SANDBOX_API_KEY=your_sandbox_api_key_here
```
4. **Run Pending Orders Migration**:
```bash
mysql -u root -p cbd420 < migrations/create_pending_orders.sql
```
5. **Test Payments**:
- Create test payments through the application
- Payments will use the sandbox environment
- No real money will be charged
### Production Setup
1. **Get Production API Key** from [NOWPayments Dashboard](https://nowpayments.io/)
2. **Update Environment Variables**:
```env
NOWPAYMENTS_TESTNET=false
NOWPAYMENTS_API_KEY=your_production_api_key_here
NEXT_PUBLIC_BASE_URL=https://yourdomain.com
```
## Project Structure
- `app/` - Next.js app directory
- `api/drops/` - API routes for drop management
- `api/payments/` - Payment integration endpoints
- `admin/` - Admin panel page
- `components/` - React components
- `lib/db.ts` - Database connection pool
- `lib/nowpayments.ts` - NOWPayments API configuration
- `cbd420.sql` - Database schema
- `migrations/` - Database migration files