npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

razornode

v1.1.1

Published

NodeJS SDK for RazorPay's API

Downloads

21

Readme

RazorNode

A dependancy free NodeJS SDK and Webhooks Handler for RazorPay's API

RazorNode is a NodeJS SDK for RazorPay. It focuses on being simple, extensible and thoroughly tested. It internally uses Promises to allow for a robust asynchornous code that doesn't 🍲 up.

Install all the Razors

To install, simply run

npm install razornode

To start using RazorNode, simply create a new instance and get started:

var razorNode = require("razornode").razorNode;
var instance  = new razorNode(process.env.rzKey, process.env.rzSecret);

instance.getPayments("2015-09-01", "2015-09-30")
.then(function (result) {
    //result has two keys
    //result.response has the response body 
    //result.responseObject has the parsed JSON
})

As you can see, we're pulling in the key and secret of your RazorPay account from the environment variables. You're free to set things up as per your preference, but this seems to be the recommended way (by some Javascript Dude, so don't quote me on it 😉)

-- RazorPay recently announced webhooks support which is currently in BETA. At the moment, only one event is supported. As new events become supported, I'll update RazorNode.

At the moment, only the "authorized" event is supported. Visit https://dashboard.razorpay.com/#/app/webhooks to setup your webhooks.

To use the webhooks handler, simply create a new instance of razorHook (currently only supported in ExpressJS apps)

var razorNode = require("razornode").razorNode;
var hooks = new razorHook({
    app: app,
    route: "/razornode"
})

hooks.on("authorized", (evt) => {

    var rawData = evt.rawData
    var payment = evt.payment
    
    console.log("new payment authorized", payment)

}) 

View ./hooks/ for a complete working example of an express app.

--
Want to test it? Please read the header of the test file located at ./test/test.js before running the tests.

If you don't have Mocha installed

npm install -g mocha

Then simply run

npm run test-local

Supported API Endpoints

| METHOD | API | Param Checking | Supported | |---|---|---|---| |GET|/payments|✅|✅| |GET|/payments/:paymentID|✅|✅| |POST|/payments/:paymentID/capture|✅|✅| |POST|/payments/:paymentID/refund|✅|✅| |GET|/payments/:paymentID/refunds|✅|✅| |GET|/payments/:paymentID/refunds/:refundID|✅|✅|

APIs listed in the docs: 6
APIs supported by RazorNode: 6

Author's Notes

  • ~~RazorNode is written in ES6. It's currently transpiled into ES5 for supporting 0.12.x. At some point, I'll remove the transpiled files from the repo and change things to use the ES6 files. However, if you'd like to keep using transpiled versions, simply install the babel-cli and run npm run build.~~
  • RazorNode is now completely based on the ES6 syntax. NodeJS 5.x is recommended.
  • RazorNode is a 3rd party implementation. I'm a RazorPay customer. I do not work for or at RazorPay and I'm in no way affiliated with them.

Feature Requests, Issues & Pull Requests

  • If you'd like to implement new things or tackle todos, please fork, edit and send a pull request. Everytime you help me tick off a todo, you earn a 🍪 point.
  • If you'd like to request a new feature, open a new issue and tag it appropriately.
  • If you'd like to discuss something else, please search the issues section before you create a new one. If you do so, please tag is appropriately.
  • If you're using the Issues section, remember to be nice. You earn a 🍪 point everytime you do.
  • Please avoid directly emailing me or any of my colleagues asking when things will progress. We work on Open-source projects as time permits. So I request you to be patient with us.

Todos

  • [x] Use native Promise
  • [x] get rid of all dependencies

License

RazorPay is licensed under the MIT License. Please refer to the LICENSE file for more information.