enhancementgood first issuehacktoberfesthelp wanted
仓库指标
- 星标
- (5 个星标)
- PR 合并指标
- (PR 指标待抓取)
描述
Description: Implement a secure Razorpay payment gateway integration so that users can pay the registration fee for individual events directly from the event details or listing page.
After successful payment, users should be redirected to /ticket (new route) — where ticket generation will be handled in a future issue.
Acceptance Criteria ✅
-
Payment Button
- Use the "Pay Now" button of event card.
- Only show it when
event. Fee > 0. - If
event. Fee === 0, show “Free Event” (disabled or highlighted button).
-
Razorpay Integration
-
Use the official Razorpay Docs flow for client-side integration.
-
On click:
- Call a backend route (e.g.
/api/payment/order) to create a Razorpay order using the event fee. - Then open the Razorpay checkout with order details (amount, name, event info, etc.).
- Call a backend route (e.g.
-
-
Redirection
-
On successful payment:
- Redirect the user to
/ticketroute (can be done vianavigate('/ticket')in React). - Pass basic info in localStorage or context (e.g., eventId, paymentId).
- Redirect the user to
-
On failure, show an error toast/snackbar.
-
-
Ticket Page Setup
- Create a new React route:
/ticket - For now, display a placeholder UI
- This will be extended in a new issue for dynamic ticket generation.
- Create a new React route:
-
Security
- Keep Razorpay keys in
.envfiles (client/public for key_id, server for key_secret). - Validate payment signature on the backend after success callback.
- Keep Razorpay keys in
Future Issue Dependencies
- 🎟️ Next Issue: Implement ticket generation and QR code display in
/ticket. - 📩 Optional Future: Send confirmation email with payment receipt + ticket.