Skip to content

Feat/razorpay gateway: Added Razorpay Payment Gateway - #115

Merged
HendrixString merged 7 commits into
store-craft:mainfrom
nischaldoescode:feat/razorpay-gateway
May 2, 2026
Merged

HendrixString merged 7 commits into
store-craft:mainfrom
nischaldoescode:feat/razorpay-gateway

Conversation

@nischaldoescode

Copy link
Copy Markdown
Contributor

Closes: #110

Overview

This PR adds an official Razorpay payment gateway integration to Storecraft.

The implementation follows the existing gateway architecture used in PayPal and Stripe and enables developers in India and South Asia to accept payments using Razorpay.

Features

  • Razorpay order creation via onCheckoutCreate
  • Synchronous payment verification via onCheckoutComplete
  • Webhook handling with signature verification
  • Support for:
    • capture
    • refund
    • status checks
  • Buy link HTML integration using Razorpay Checkout
  • Configurable manual and automatic capture modes

Package Structure

packages/payments/payments-razor-pay

Mirrors structure of existing gateways for consistency.

Includes:

  • Gateway implementation
  • Types
  • Tests
  • README
  • Example usage

Implementation Details

Gateway lifecycle methods implemented:

  • onCheckoutCreate
  • onCheckoutComplete
  • webhook
  • status
  • invokeAction
  • onBuyLinkHtml (included for chat checkout support)

Why this is needed

Razorpay is dominant in India and South Asia.

Many developers cannot use Stripe/PayPal due to regional restrictions.

This integration expands Storecraft’s accessibility and adoption in new markets.

Testing

  • Unit tests included (npm test)
  • Local integration testing using Razorpay test mode
  • Test cards and sandbox environment verified
  • Follows existing testing pattern (app.test.js equivalent)

Configuration

{
  "key_id": "string",
  "key_secret": "string",
  "default_currency_code": "string (optional)",
  "capture_mode": "manual | auto (optional)"
}

Supports environment variables fallback:
- RAZORPAY_KEY_ID
- RAZORPAY_KEY_SECRET

Webhook Support

Handles:

  • payment.authorized
  • payment.captured
  • payment.failed
  • refund.processed

Unrecognized events are safely ignored.

Documentation

  • Added README with setup, configuration, and testing instructions
  • Includes example usage inside Storecraft app

Status

  • Fully functional
  • Tested locally
  • Ready for review

Regards,
Nischal

@nischaldoescode

nischaldoescode commented May 2, 2026 •

Copy link
Copy Markdown
Contributor Author

It's weird to see it's failing I checked it all in my local machine and it worked. Seems to me that payments-razor-pay does not exist on lock file.

@HendrixString

HendrixString commented May 2, 2026 •

Copy link
Copy Markdown
Member

@nischaldoescode Hi, first of all the PR looks great. You really nailed the design patterns of the project.
you forgot to run npm install in your computer:

  • this will add your package into the global lock file
  • then, commit the global lock file
  • and then the ci will not complain
  • right now npm ci detects that there is a new package (payments-razorpay), that is not part of the lock file

I would have done it myself, but, the repo is a PR coming from your account.

@nischaldoescode

Copy link
Copy Markdown
Contributor Author

@nischaldoescode Hi,
you forgot to run npm install in your computer:

  • this will add your package into the global lock file
  • then, commit the global lock file
  • and then the ci will not complain

I would have done it myself, but, the repo is a PR coming from your account

I think I ran it... Anyways will do it in a second.

@HendrixString

Copy link
Copy Markdown
Member

@nischaldoescode any news ? if you are having a hard time with the lock file, just delete it and run npm install from the root of the mono-repo

@nischaldoescode

nischaldoescode commented May 2, 2026 •

Copy link
Copy Markdown
Contributor Author

@nischaldoescode any news ? if you are having a hard time with the lock file, just delete it and run npm install from the root of the mono-repo

Done, and sorry about the commit message and the delay..

i was in a hurry.

all the tests now should be successful.

happy building and happy merging, sir. and Happy Coding Indeed.

ThankYou.

Cheers,
Nischal

@HendrixString

Copy link
Copy Markdown
Member

@nischaldoescode cool. Thank you, now:

  1. I will merge it
  2. I will create a new release
  3. I will publish to NPM

Stay tuned in the next hour

@HendrixString
HendrixString merged commit b82c035 into store-craft:main May 2, 2026
6 checks passed
@HendrixString

Copy link
Copy Markdown
Member

@nischaldoescode i am still working on releasing and publishing. NPM changed a few things, so i have some writing to do. i hope i will release your packages soon

@nischaldoescode

nischaldoescode commented May 2, 2026 •

Copy link
Copy Markdown
Contributor Author

@nischaldoescode i am still working on releasing and publishing. NPM changed a few things, so i have some writing to do. i hope i will release your packages soon

Yeah they changed after a CVE was discovered. npm is turning I mean I personally prefer yarn over it. I switched from windows too.

Yeah and best of luck. Waiting for the updates.

@HendrixString

Copy link
Copy Markdown
Member

@nischaldoescode
yeah they made 2FA mandatory. It actually made me write a simpler versioning and publishing logic now, that depends solely on the npm workspace feature.

So, everything is published now v1.4.2, thank you very much for the contribution, i hope you will find storecraft useful.

Fell free to add more PRs as you see fit. I will put you on the fast lane 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Razorpay Payment Gateway Integration Proposal

2 participants