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 🙏

© 2026 – Pkg Stats / Ryan Hefner

faragate

v1.0.2

Published

An easy-to-use Node.js package for communicate with Faragate.com Online Payment APIs.

Downloads

6

Readme

Faragate Node.js Module

Faragate Node.js Module

This package is made for Faragate.com website that allows developers to work with Faragate Online Payment APIs quickly and easily in node.js!

Dependencies

This module is dependent on following packages:

  • Request
  • body-parser (Use POST input parameters)

How to install

For install this package, run below command:

$ npm install faragate --save

Now you can use package's methods by require it:

var faragate = require("faragate");

Methods

paymentRequest:

paramaters:

  • res: The response (res) variable of your Framework in routing request scope.
  • merchantCode: Your unique Faragate merchant code.
  • rialPrice: Product price in Rial (ريال) format.
  • returnUrl: After complete payment processes, user will redirect to this url and Faragate web service, will POST payment's status to the URL.
  • invoiceNumber: The unique ProductID or InvoiceNumber.
  • options: Other Faragate REST-API options in key-value object format. SandBox for testing, Paymenter Name/Email/Mobile and etc. (See this link for more information)

Example in Express (Production Mode):

var faragate = require("faragate");
var marchent = "YOUR_MARCHENT_CODE";
    
app.get('/pay', function(req, res){
	faragate.paymentRequest(res, marchent, "RIAL_PRICE", "http://YOUR_WEBSITE.com/pay","INVOICE_NUMBER", {PaymenterName: "Erfan Sahafnejad"});
});    

Important note: Never send any response like res.end and res.send in this route, paymentRequest will send response automatically.


verifyPayment:

After call paymentRequest, you should use this method for check user payment status in your callback page (in POST method). If user returned to your callback url from Faragate gateway, you have a Token variable in your header.

paramaters:

  • merchantCode: Your unique Faragate merchant code.

  • token: The Token that Faragate will post to your callback. (Accessible from req.body.Token, don't forget that Body-Parser package is required.)

  • cb: Your async function for handle user payment status. This function has 3 input:

    • State|Bool: if payment was successful will be True otherwise, will be False
    • StatusCode|Integer: if payment was successful will have value 1, otherwise will containing error code that is a negative number
    • Message|String: A string that is containing payment status text
  • sandbox: If you are in developing mode and you want test your code, put it true otherwise in production mode, should be false. Default value is False.

Example in Express (Production Mode):

var faragate = require("faragate");
var marchent = "YOUR_MARCHENT_CODE";
    
app.get('/', function(req, res){
	faragate.paymentRequest(res, marchent, "10000", "http://YOUR_WEBSITE.com/pay","0123456789", {PaymenterName: "Erfan Sahafnejad"});
});    

app.post("/pay", function(req, res){
    var token = req.body.Token;
    faragate.verifyPayment(marchent, token, function(status, code, message){
        var text = "Payment status: " + status + "<br>Code: " + code + "<br>Message: " + message;
        res.send(text);
    });
});

getBalance:

You can use this function to get your account balance in Rial format. Remember you wille need Faragate WebService Password for working with this method. For set Web Service Password see this link.

paramaters:

  • username: Your Faragate username.
  • password: Your Faragate Web Service Password.
  • cb: Async callback function with 3 input parameters:
    • Balance|Integer: Account balance in Rail format.
    • Status|Integer: Response status code.
    • Message|String: Response message text.

Example in Express (Production Mode):

var faragate = require("faragate");
var marchent = "YOUR_MARCHENT_CODE";
    
app.get('/balance', function(req, res){
    faragate.getBalance("USERNAME", "PASSWORD", function(balance, code, message){
      res.send(balance + " Rial" + "<br>Message: " + message);
    });
});

License

This package is under Apache License 2.0