-
Notifications
You must be signed in to change notification settings - Fork 6
feat: add razorpay #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @bajrangCoder, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the platform's monetization capabilities by integrating Razorpay as a new payment gateway for web-based plugin purchases. It provides a complete end-to-end solution, from a user-friendly "Buy" button on the client-side to robust server-side APIs for secure transaction processing, payment verification, and webhook handling. The underlying database schema has been extended to support user-specific purchase records across different payment providers, ensuring that once a plugin is bought, it's permanently linked to the user's account for seamless access and download. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Greptile OverviewGreptile SummaryThis PR adds Razorpay payment gateway integration to enable web-based plugin purchases, complementing the existing Google Play integration for mobile. Key ChangesBackend (Server)
Frontend (Client)
Configuration
Critical Issues Found
ArchitectureThe implementation follows a dual-verification pattern: client-side payment verification for immediate user feedback, with webhook handlers providing redundancy and handling edge cases where the client callback fails. This is a sound approach for payment systems. Confidence Score: 2/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant Browser
participant Server
participant Razorpay
participant Database
Note over User,Database: Payment Flow for Web Purchase
User->>Browser: Click "Buy" button
Browser->>Server: POST /api/razorpay/create-order
Server->>Database: Check user already owns plugin
Database-->>Server: No existing purchase
Server->>Razorpay: Create order (amount, receipt, notes)
Razorpay-->>Server: Order details (orderId, amount)
Server-->>Browser: Order data + keyId
Browser->>Razorpay: Open checkout modal
User->>Razorpay: Complete payment
Razorpay->>Razorpay: Process payment
alt Payment Success
Razorpay-->>Browser: Payment response (orderId, paymentId, signature)
Browser->>Server: POST /api/razorpay/verify
Server->>Server: Verify signature (HMAC-SHA256)
Server->>Database: Check order doesn't exist
Server->>Database: Insert purchase order
Database-->>Server: Success
Server-->>Browser: Payment verified
Browser-->>User: Show success message
Note over Razorpay,Server: Webhook (async, for redundancy)
Razorpay->>Server: POST /api/razorpay/webhook (payment.captured)
Server->>Server: Verify webhook signature
Server->>Database: Check/update order state
Server-->>Razorpay: 200 OK
else Payment Failed
Razorpay-->>Browser: Payment failed event
Browser-->>User: Show error message
Razorpay->>Server: POST /api/razorpay/webhook (payment.failed)
Server->>Database: Update order state to CANCELED
Server-->>Razorpay: 200 OK
end
Note over User,Database: Download Flow
User->>Browser: Request plugin download
Browser->>Server: GET /api/plugin/download/:id
Server->>Database: Get user's orders
Database-->>Server: Purchase order found
Server-->>Browser: Plugin ZIP file
Browser-->>User: Download starts
|
ENV to be Updated before Merger.
PG_KEY_IDPG_KEY_SECRETPG_WEBHOOK_SECRET