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

pay-instamojo

v1.0.4

Published

NPM Package To Connect Instamojo In Node Application Easily

Downloads

15

Readme

NPM Package For Instamojo Payment Gateway REST API

HitCount Generic badge GitHub license GitHub contributors GitHub issues GitHub issues-closed

NPM

A node.js module, which provides an object oriented wrapper for the Instamojo REST API.

This library is built to support version 1.1 of the Instamojo API.

Instamojo API documentation can be found here

All About Instamojo

Installation

Install with the node package manager npm:

$ npm install pay-instamojo

How To Use?

Create the Instamojo client

const InstamojoApi = require('pay-instamojo').instamojo;

const instamojo = new InstamojoApi({
  host: <instamojo-host>,
  apiKey: <instamojo-x-api-key>,
  authToken: <instamojo-x-auth-token>
});

Get List of All Payment Requests

/* For getRequestLists input is not required, hence first parameter is null in this call. */

instamojo.getRequestLists(null, (error, body) => {
  console.log('RESPONSE: ', error, body);
});

Create Payment Request


let input = {
  allowRepeatedPayment: <your-choice>, // true or false (boolean)
  amount: <amount-to-pay>, // e.g., 10
  buyerName: <buyer-name>,
  purpose: <purpose-of-payment>,
  redirectUrl: <redirectUrl-if-any>,
  phone: <phone-number>, // 10 digit valid phone number if any
  sendSMS: <your-choice>, // true or false (if true then phone is mandatory)
  email: <email-id-to-send-payment-link>, // valid email if any
  sendEmail: <your-choice>, // true or false (if true then email is mandatory)
  webhook: <webhook-url>
}
instamojo.createRequest(input, function (error, body) {
  console.log('RESPONSE:', error, body)
})

Get Payment Request By Id


let input = {
  paymentRequestId: <payment-request-id>
}
instamojo.getPaymentRequestById(input, function (error, body) {
  console.log('RESPONSE:', error, body)
})

Create A Refund Request

Find input parameter values definition here


let input = {
  paymentId: <payment-id>, // Id you got as payment acknowledgment
  type: <code-to-identify-reason-for-this>,
  refundAmount: <paid-amount>, // not mandatory (if preset then valid amount)
  body: <text-explaining-refund> // not mandatory
}
instamojo.createRefund(input, function (error, body) {
  console.log('RESPONSE:', error, body)
})

Get List of Refunds

/* For getListOfRefunds input is not required, hence first parameter is null in this call. */

instamojo.getListOfRefunds(null, (error, body) => {
  console.log('RESPONSE: ', error, body);
});

Get Refund Details By Id


let input = {
  refundId: <refund-id>
}
instamojo.getRefundDetailsById(input, function (error, body) {
  console.log('RESPONSE:', error, body)
})

Get Payment Details By Id


let input = {
  paymentId: <refund-id>
}
instamojo.getPaymentDetailsById(input, function (error, body) {
  console.log('RESPONSE:', error, body)
})

Disable Payment Request By Id


let input = {
  paymentRequestId: <payment-request-id>
}
instamojo.disablePaymentRequest(input, function (error, body) {
  console.log('RESPONSE:', error, body)
})

Enable Payment Request By Id


let input = {
  paymentRequestId: <payment-request-id>
}
instamojo.enablePaymentRequest(input, function (error, body) {
  console.log('RESPONSE:', error, body)
})

Options

InstamojoApi options:

  • host<string>: The hostname for instamojo
  • apiKey<string>: Instamojo X-Api-Key
  • authToken<string>: Instamojo X-Auth-Token

Implemented APIs

  • Get List of All Payment Requests
  • Create Payment Request
  • Get Payment Request By Id
  • Create Refund
  • Get List Of Refunds
  • Get Refund Details By Id
  • Get Payment Details By Id
  • Disable Payment Request By Id
  • Enable Payment Request By Id

Changelog

  • 1.0.3 getListOfRefunds, getRefundDetailsById, getPaymentDetailsById, disablePaymentRequest, enablePaymentRequest functions added
  • 1.0.2 get payment request by id, create refund function added
  • 1.0.1 request dependency missing (added in package.json)
  • 1.0.0 Initial version