Razorpay Node SDK
![npm](https://img.shields.io/npm/v/razorpay.svg?maxAge=2592000?style=flat-square)
Official nodejs library for Razorpay API.
Read up here for getting started and understanding the payment flow with Razorpay: https://docs.razorpay.com/docs/getting-started
Installation
npm i razorpay
Documentation
Documentation of Razorpay's API and their usage is available at https://docs.razorpay.com
Basic Usage
Instantiate the razorpay instance with key_id
& key_secret
. You can obtain the keys from the dashboard app (https://dashboard.razorpay.com/#/app/keys)
const Razorpay = require('razorpay');
var instance = new Razorpay({
key_id: 'YOUR_KEY_ID',
key_secret: 'YOUR_KEY_SECRET',
});
The resources can be accessed via the instance. All the methods invocations follows the namespaced signature
instance.payments.fetch(paymentId);
Every resource method returns a promise.
instance.payments
.all({
from: '2016-08-01',
to: '2016-08-20',
})
.then(response => {
})
.catch(error => {
});
If you want to use callbacks instead of promises, every resource method will accept a callback function as a last parameter. The callback functions will behave as Error First Callbacks
instance.payments.all(
{
from: '2016-08-01',
to: '2016-08-20',
},
(error, response) => {
if (error) {
} else {
}
}
);
Supported Resources
Development
npm install
Testing
npm test
Release
- Switch to
master
branch. Make sure you have the latest changes in the local master - Update the
CHANGELOG.md
& bump the version in package.json
- Commit
- Tag the release & push to Github
- Create a release on GitHub using the website with more details about the release
- Publish to npm with
npm publish
command
Licence
MIT Licensed. See LICENSE.txt for more details
2.8.6 - 2023-02-22
feat(Typescript): add typescript definitions
- TypeScript definitions for all modules and functions in the SDK.
- Add comments throughout the codebase to improve readability and maintainability.
- Add a type declarations file (*.d.ts) to provide better type checking and editor support for consumers of the SDK.
Overall, this update should provide a better developer experience for anyone using the SDK, by leveraging the power of TypeScript's static type checking and providing clearer documentation and comments throughout the codebase.
Note: This release is a patch of the previous release that includes an update to the razorpay.d.ts
file