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

billdeskjs

v1.0.0

Published

A tool to integrate billdesk payment gateway

Downloads

582

Readme

billdeskJS

A tool to integrate billdesk payment gateway in JS

Usage

After installation simply require the module in your file like this.

const billdesk = require('billdeskjs');

Now, you need to define some environment variables like

MID = <ur merchant id>;
SEC_ID = <ur security id>;
BILL_URL = <billdesk_url>;
CONF_BILL_URL = <url for scheduled checks>;
CHECKSUM_KEY = <ur checksum>;
RETURN_URL = <ur return url>;

All the above mention variables (except for return url) will be provided by billdesk to you on request.

Now,to use it in ur project,simply make a new object of the class you required by doing

const client = new billdesk(MID, SEC_ID, CHECKSUM_KEY, RETURN_URL);

This needs to be done at the beginning of your script Now, use it by to generate message for in the format that billdesk requires and then send a post request to the BILL_URL from a html form

var msg = client.get_message(uniqueTransactionID,amount,aditionalInfo1,aditionalInfo2,aditionalInfo3,aditionalInfo4)

You will receive a response at your return url which needs to be parsed.(Take a look at the structure of retrun url here) The response received will be a array containing several fields.Pass the 'msg' parameter like this

var response = receivedResponse.msg; //assuming u stored the response in receivedResponse
var parsedResponse = client.responseMsg(response);

Now parsedResponse will have this structure

{
  MID: 'ur mid',
  OrderID: 'ur unique transaction id(passed at the time of message generation)',
  TaxnNo: 'taxation number for the transaction(generated by billdesk)',
  AMNT: 'transaction amount',
  TStat: 'transaction status',
  DnT: 'date and time (ex 09-03-2021 00:44:45)',
  TMode: 'transaction mode (ex Netbanking)'
}

Note All the data types are string in the above array.

Now TStat update your database on the basis of TStat.Take a look at the billdesk official documentation or this gist for more info about Status Codes.

Now, some transaction may not be processed instantly and will have a Transaction Status code as given here. They will require you to send requests after every 1 hour until billdesk gives you some different resposne. Now, the structure of this query message will somewhat different than that of message obtained by client.get_message(...) .This format of message can be obtained by

schedule_msg = client.get_schedule_msg(<order_id>);

order_id is the unique id YOU generated for each transaction. You will send this message to CONF_BILL_URL and the message you will recieve again needs to be parsed. To do so

schedule_resp = client.schedule_resp(<response recieved>);

The structure of schedule_resp will be

{
  MID: 'ur mid',
  TaxnNo: 'taxation number for the transaction(generated by billdesk)',
  OrderID: 'ur unique transaction id(passed at the time of message generation)',
  TStat: 'transaction status',
  RfndStat : 'refund status',
  AMNT: 'transaction amount'
}

The database should be updated on the basis of combination of status code and refund status which can be found in billdesk official documnetation or here.