Skip to content

Implement Razorpay payment integration #5

Description

@darshacharya

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

  • Razorpay order is created server-side
  • Frontend opens Razorpay checkout
  • Payment signature is verified server-side
  • Donation only completes after verified payment
  • Mock gateway still works for local development
  • Failed payments are handled gracefully

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBackend relatedenhancementNew feature or requestfrontendFrontend related

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions