feat: add Razorpay payment gateway support#1245
Open
ritaban06 wants to merge 8 commits into
Open
Conversation
Add a comprehensive Stripe integration reference at backend/docs/stripe-integration.md. The new doc details end-to-end Stripe handling for Hi.Events including environment variables, dependencies, architecture and checkout flow, database schema (stripe_customers, stripe_payments, stripe_payouts, account_stripe_platforms and order additions), backend infrastructure and domain services (configuration, client factory, payment intent creation/refunds, account sync, payout and fee extraction), application handlers and HTTP actions/routes, webhook security and idempotency, frontend React components and queries, SaaS vs open-source behaviours, multi-platform support, refund and payout reconciliation flows, testing commands and a key files reference.
Introduce full Razorpay payment provider support: add env keys, docs and docker updates, and a DB migration for razorpay_orders. New domain objects, Eloquent model, repository + interface, and generated RazorpayOrder domain class. Implement infrastructure services (client factory, configuration, signature verification), domain services (order creation, payment completion, refund), application handlers (create order, payment callback, incoming webhook, refund handler) and webhook/event handlers for payment.captured, payment.failed and refund.processed with idempotency via cache. Add HTTP actions (public create order, payment callback, webhook), integrate provider in RepositoryServiceProvider, and add a Razorpay-specific exception. Update refund flow to route between Stripe and Razorpay based on order payment provider and surface gateway errors generically. Frontend: add Razorpay payment method component, client call and a hook to create Razorpay orders. Composer and service config updated accordingly.
Add razorpay/razorpay (v2.9) to backend composer.json and update composer.lock. The lockfile now includes razorpay/razorpay and its dependency rmccue/requests, and updates content-hash and plugin-api-version. This change enables using the Razorpay PHP client in the backend.
Register Razorpay actions and routes in the API: import Razorpay webhook and payment action classes, add public endpoints for creating Razorpay orders and handling payment callbacks, and expose a /webhooks/razorpay webhook endpoint. This enables support for Razorpay as an additional payment gateway.
Add an id to the injected Razorpay script and early-return from the effect if an element with that id already exists. Also remove the cleanup that removed the script on unmount so the shared SDK isn't removed when individual components unmount. This prevents multiple injections and related side effects when the component mounts repeatedly.
Tighten pre-checks in CreateRazorpayOrderHandler: use getSessionId() for session verification and throw an UnauthorizedException with a user-friendly message when session verification fails. Add an explicit check that the order status is RESERVED and not expired, throwing a ResourceConflictException if the order is expired or in an invalid state. These changes prevent creating Razorpay orders for invalid or expired orders.
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes I've made
Why I've made these changes
Razorpay is one of the most widely used payment gateways in India and supports UPI, credit/debit cards, net banking, and wallets. Adding Razorpay enables Hi.Events to better support organizers in India by allowing them to accept local payments without relying on international payment providers.
How I've tested these changes
Checklist
Closes #1246