Description
The donation system currently uses a mock payment gateway that always succeeds. Replace it with real Razorpay integration for production use.
Current State
backend/app/services/payment.py defines a PaymentGateway protocol and MockPaymentGateway
backend/app/routers/donations.py calls payment_gateway.create_payment() but never verifies
- Donations are immediately marked as
COMPLETED without actual payment
Requirements
Backend
- Implement
RazorpayGateway class in backend/app/services/payment.py
- Add
POST /api/payments/create-order to create a Razorpay order
- Add
POST /api/payments/verify to verify payment signature after completion
- Only mark donation as
COMPLETED and update raised_amount after verification
- Add Razorpay credentials to config (
RAZORPAY_KEY_ID, RAZORPAY_KEY_SECRET)
- Keep
MockPaymentGateway as default for development
Frontend
- Integrate Razorpay checkout.js in the donate modal
- Handle payment success/failure callbacks
- Show payment status feedback
Tech Notes
Acceptance Criteria
Description
The donation system currently uses a mock payment gateway that always succeeds. Replace it with real Razorpay integration for production use.
Current State
backend/app/services/payment.pydefines aPaymentGatewayprotocol andMockPaymentGatewaybackend/app/routers/donations.pycallspayment_gateway.create_payment()but never verifiesCOMPLETEDwithout actual paymentRequirements
Backend
RazorpayGatewayclass inbackend/app/services/payment.pyPOST /api/payments/create-orderto create a Razorpay orderPOST /api/payments/verifyto verify payment signature after completionCOMPLETEDand updateraised_amountafter verificationRAZORPAY_KEY_ID,RAZORPAY_KEY_SECRET)MockPaymentGatewayas default for developmentFrontend
Tech Notes
razorpay(Python SDK)Acceptance Criteria