# razorpay

> Official Node SDK for Razorpay API

Latest version **2.9.8** (published 2026-07-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install razorpay
pnpm add razorpay
yarn add razorpay
bun add razorpay
```

## Health

**Score 55/100 (C)** — status: active.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.9.8 |
| Published | 2026-07-15 |
| First published | 2016-09-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 350.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 241 |
| Maintainers | razorpay-dev, vivek_shindhe9604, pronav, kamleshchandnani, captn3m0, ankit_razorpay |
| Keywords | razorpay, payments, node, nodejs, razorpay-node |

## Links

- npm: https://www.npmjs.com/package/razorpay
- Repository: https://github.com/razorpay/razorpay-node
- Homepage: https://github.com/razorpay/razorpay-node#readme
- Issues: https://github.com/razorpay/razorpay-node/issues
- npm.io page: https://npm.io/package/razorpay

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^1.18.1

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 2.9.8 (latest) — 2026-07-15
- 2.9.6 — 2025-02-24
- 2.9.5 — 2024-10-23
- 2.9.4 — 2024-05-17
- 2.9.3 — 2024-04-18
- 2.9.2 — 2023-08-16
- 2.9.1 — 2023-07-18
- 2.9.0 — 2023-06-30
- 2.8.6 — 2023-02-22
- 2.8.5 — 2023-02-22
- 2.8.4 — 2022-11-24
- 2.8.3 — 2022-08-03
- 2.8.2 — 2022-06-29
- 2.8.1 — 2022-03-10
- 2.8.0 — 2021-11-24
- … 25 more at https://npm.io/package/razorpay/versions

## README

# Razorpay Node SDK

[![npm](https://img.shields.io/npm/v/razorpay.svg?maxAge=2592000?style=flat-square)](https://www.npmjs.com/package/razorpay)

Official nodejs library for [Razorpay API](https://docs.razorpay.com/docs/payments).

Read up here for getting started and understanding the payment flow with Razorpay: <https://docs.razorpay.com/docs/getting-started>

## Installation

```bash
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](https://dashboard.razorpay.com/#/app/keys))

```js
const Razorpay = require('razorpay');

var instance = new Razorpay({
  key_id: 'YOUR_KEY_ID',
  key_secret: 'YOUR_KEY_SECRET',
});
```

### Using Access Token
Instantiate the razorpay instance with `access_token`. The `access_token` can be obtained only in case if you are a platform partner. For more information, refer page - https://razorpay.com/docs/partners/platform/.

```js
const Razorpay = require('razorpay');

var instance = new Razorpay({
  "oauthToken": "ACCESS_TOKEN"
})
```
x
The resources can be accessed via the instance. All the methods invocations follows the namespaced signature

```js
// API signature
// {razorpayInstance}.{resourceName}.{methodName}(resourceId [, params])

// example
instance.payments.fetch(paymentId);
```

Every resource method returns a promise.

```js
instance.payments
  .all({
    from: '2016-08-01',
    to: '2016-08-20',
  })
  .then(response => {
    // handle success
  })
  .catch(error => {
    // handle 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 ](http://fredkschott.com/post/2014/03/understanding-error-first-callbacks-in-node-js/)

```js
instance.payments.all(
  {
    from: '2016-08-01',
    to: '2016-08-20',
  },
  (error, response) => {
    if (error) {
      // handle error
    } else {
      // handle success
    }
  }
);
```

## Supported Resources
- [Account](documents/account.md)

- [Addon](documents/addon.md)

- [Item](documents/items.md)

- [Customer](documents/customer.md)

- [Token](documents/token.md)

- [Order](documents/order.md)

- [Payments](documents/payment.md)

- [Settlements](documents/settlement.md)

- [Fund](documents/fund.md)

- [Refunds](documents/refund.md)

- [Invoice](documents/invoice.md)

- [Subscriptions](documents/subscription.md)

- [Payment Links](documents/paymentLink.md)

- [Product Configuration](documents/productConfiguration)

- [Smart Collect](documents/virtualAccount.md)

- [Stakeholder](documents/stakeholders.md)

- [Route](documents/transfer.md)

- [QR Code](documents/qrcode.md)

- [Emandate](documents/emandate.md)

- [Cards](documents/card.md)

- [Paper NACH](documents/papernach.md)

- [UPI](documents/upi.md)

- [Register Emandate and Charge First Payment Together](documents/registerEmandate.md)

- [Register NACH and Charge First Payment Together](documents/registerNach.md)

- [Payment Verification](documents/paymentVerfication.md)

- [Webhook](documents/webhook.md)

- [Dispute](documents/disputes.md)

- [Document](documents/documents.md)

- [oAuthTokenClient](documents/oAuthTokenClient.md)

---

## Development

```bash
npm install
```

## Testing

```bash
npm test
```

## Release

1.  Switch to `master` branch. Make sure you have the latest changes in the local master
2.  Update the `CHANGELOG.md` & bump the version in `package.json`
3.  Commit
4.  Tag the release & push to Github
5.  Create a release on GitHub using the website with more details about the release
6.  Publish to npm with `npm publish` command

## Licence

MIT Licensed. See [LICENSE.txt](LICENSE.txt) for more details

---
_Source: https://npm.io/package/razorpay · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
