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

instamojo-nodejs

v0.0.5

Published

Instamojo API Wrapper

Downloads

1,713

Readme

Instamojo NodeJs Wrapper

A node wrapper library for Instamojo APIs.

npm install instamojo-nodejs

Include and set keys

var Insta = require('instamojo-nodejs');
Insta.setKeys(API_KEY, AUTH_KEY);

APIs Available

Create new payment request

var data = new Insta.PaymentData();

data.purpose = "Test";            // REQUIRED
data.amount = 9;                  // REQUIRED
data.setRedirectUrl(REDIRECT_URL);

Insta.createPayment(data, function(error, response) {
  if (error) {
    // some error
  } else {
    // Payment redirection link at response.payment_request.longurl
    console.log(response);
  }
});

You can set additional data parameters. See here

See all payment links

Insta.seeAllLinks(function(error, response) {
  if (error) {
    // Some error
  } else {
    console.log(response);
  }
});

Get all payment requests

Insta.getAllPaymentRequests(function(error, response) {
  if (error) {
    // Some error
  } else {
    console.log(response);
  }
});

Get payment status for a particular payment request id

Insta.getPaymentRequestStatus("PAYMENT-REQUEST-ID", function(error, response) {
  if (error) {
    // Some error
  } else {
    console.log(response);
  }
});

Get payment details for a particular payment id and payment request id

Insta.getPaymentDetails("PAYMENT-REQUEST-ID", "PAYMENT-ID", function(error, response) {
  if (error) {
    // Some error
  } else {
    console.log(response);
  }
});

Initiate refund

var refund = new Insta.RefundRequest();
refund.payment_id = '';     // This is the payment_id, NOT payment_request_id
refund.type       = '';     // Available : ['RFD', 'TNR', 'QFL', 'QNR', 'EWN', 'TAN', 'PTH']
refund.body       = '';     // Reason for refund
refund.setRefundAmount(8);  // Optional, if you want to refund partial amount
Insta.createRefund(refund, function(error, response) {
  console.log(response);
});

Details on refund types here.

Get refund status for a refund id

Insta.getRefundDetails("REFUND-ID", function(error, response) {
  if (error) {
    // Some error
  } else {
    // Refund status at response.refund.status
    console.log(response);
  }
});

Get all refunds

Insta.getAllRefunds(function(error, response) {
  if (error) {
    // Some error
  } else {
    console.log(response);
  }
});

Additional Payment Data

data.currency                = 'INR';
data.buyer_name              = '<buyer name>';
data.email                   = '<buyer email>';
data.phone                   = 1234567890;
data.send_sms                = 'False';
data.send_email              = 'False';
data.allow_repeated_payments = 'False';
data.webhook                 = 'Your endpoint to capture POST data from a payment';
data.redirect_url            = 'Your endpoint where instamojo redirects user to after payment';

Set sandbox mode

Add this line after setting your keys

Insta.isSandboxMode(true);

Changes in v0.0.4

Changes in v0.0.3


Submit issues

You can raise an issue in this repo or mail me at [email protected]