- Go to https://stripe.com and sign up (or login)
- Go to Developers → API Keys
- Copy your Secret Key (starts with
sk_)
Create/update .env file in backend/ folder:
STRIPE_SECRET_KEY=sk_test_your_key_here
STRIPE_WEBHOOK_SECRET=whsec_test_key_here
FRONTEND_URL=http://localhost:3000
CLIENT_URL=http://localhost:3000
# Terminal 1 - Backend
cd backend
npm start
# Terminal 2 - Frontend
cd frontend
npm start- Navigate to Admin → Vendor Requests
- Accept any pending booth/bazaar request
- Vendor receives email with payment details
- Login as Vendor
- Go to "My Accepted Events"
- Click "Payment" on the accepted request
- Review amount and deadline
- Click "Pay Now"
- You'll be redirected to Stripe checkout
- Enter test card: 4242 4242 4242 4242
- Expiry: Any future date (e.g., 12/25)
- CVC: Any 3 digits (e.g., 123)
- Click "Pay"
- Should see success page
- Database shows
paymentStatus: "paid" - "Payment" button changes to "✓ Paid"
| Scenario | Card Number | Result |
|---|---|---|
| ✅ Success | 4242 4242 4242 4242 | Payment succeeds |
| 4000 0000 0000 0002 | Payment declined | |
| 🔐 Auth Required | 4000 0025 0000 3155 | Extra verification |
For any date/CVC, use: Expiry 12/25, CVC 123
To test webhooks locally without Stripe CLI:
- Stripe automatically sends webhooks when payment completes
- Check backend console for webhook logs
- In production, configure webhook endpoint in Stripe dashboard
backend/.env- Your Stripe keys go here
frontend/src/pages/VendorAcceptedEvents.jsx- Payment buttonfrontend/src/pages/PaymentSuccess.jsx- Success pagefrontend/src/pages/PaymentCancel.jsx- Cancellation page
backend/controllers/vendorRequestController.js- Creates checkout sessionbackend/controllers/stripeWebhookController.js- Processes paymentsbackend/models/paymentModel.js- Payment records
"Stripe is not configured"
- ✅ Check STRIPE_SECRET_KEY in .env
- ✅ Restart backend after adding .env
"Failed to initiate payment"
- ✅ Check backend is running (port 5000)
- ✅ Check FRONTEND_URL is correct in .env
Payment not shown in database
- ✅ Webhook might be delayed (check in 10 seconds)
- ✅ Check backend console for webhook errors
- ✅ Manually verify: Hit
/api/events/verify-payment?sessionId=...
When ready to deploy:
- Get live Stripe keys (not test keys)
- Switch Stripe dashboard to "Live Mode"
- Add webhook endpoint for production domain
- Update
.envwith live keys - Update FRONTEND_URL to your domain
See STRIPE_PAYMENT_SETUP.md for full production guide.
- Backend Console: Shows logs for debugging
- Stripe Dashboard: View all transactions
- Email Testing: Check
GET /api/dev/emailsif SMTP not configured
Questions? Check STRIPE_PAYMENT_SETUP.md or contact events@guc.edu.eg