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

payger-merchant-javascript-sdk

v1.0.3

Published

Payger Merchant Javascript API SDK

Downloads

8

Readme

PAYGER - Merchant SDK

PAYGER - Merchant Javascript SDK

Welcome to our merchant sdk tutorial.

What is this SDK?

Javascript SDK to easily connect to Payger Merchant API.

Here can find the API documentation.

Instalation

Node.js

Merchant Javascript SDK is available on npm. To install it try:

$ npm payger-merchant-javascript-sdk

Usage

Import the library in your code, and then start a new merchant to get new communication:

const merchant = new Merchant(environment, oauth2, basicAuth);

You need to specify the environment (test or production).

For reference here is described how to start oauth2 and basic authentication:


const oauth2 = {
	apiKey: "<your_api_key>",
	apiSecret: "<your_api_secret>"
};

const basicAuth = {
	user: "<your_basic_auth_user>",
	psw: "<your_basic_auth_psw>"
};

Services available

To make easier to call every actions define an object like these


const actions = {
	getBalances: "GET_BALANCES", // get all balances
	getCurrencies: "GET_CURRENCIES", // get currencies (all or filtered)
	getCurrency: "GET_CURRENCY", // get a specific currency
	getExchangeRate: "GET_EXCHANGERATES", // get exchange rates ( by filters )
	getPaymentLimits: "GET_PAYMENTLIMITS", // get payment limits
	getAllTransactions: "GET_ALLTRANSACTIONS", // get transactions (all)
	getTransactions: "GET_TRANSACTIONS", // get transactions (paginated)
	getTransaction: "GET_TRANSACTION", // get a specific transaction
	getPayments: "GET_PAYMENTS", // get payments (paginated)
	savePayment: "SAVE_PAYMENTS", // create a payment
	getPayment: "GET_PAYMENT", // get a specific payment
	updatePayment: "UPDATE_PAYMENT", // update a specific payment
	cancelPayment: "CANCEL_PAYMENT", // cancel a specific payment
	addAddress: "ADD_ADDRESS", // add an address to payment
	getFees: "GET_FEES", // get Fees
};

Here you have all available actions.

How to call an action

Is really simple to call an action. Just use your js merchant const declared before.

merchant.call(actions.<whatever_action>, data);

Every call retrieve a promise.

Fill speficic data parameter

Each method is prepared to receive a specific object.

Definition for every

Get Balances

None

Get Currencies
 from: String 
   - specific currency (I.E.: DASH)
   - Nullable: true
 
Get Currency
 String 
    - specific currency (I.E.: DASH)
    - Nullable: false
Get Exchange Rates
 productCurrency: String 
    - specific currency (I.E.: DASH)
    - Nullable: false
  amount: integer 
    - Nullable: false
  applyLimits: boolean
    - Nullable: true
  paymentCurrencies: string
    - specific currency (I.E.: DASH)
    - Nullable: true
Get Payment Limits
 page: integer 
    - Nullable: false
  size: integer 
    - Nullable: false
  sort: boolean
    - Nullable: true
Get All Transactions

None

Get Transactions
 page: integer 
    - Nullable: false
  size: integer 
    - Nullable: false
  sort: boolean
    - Nullable: true
Get Transaction
 id: integer 
    - Nullable: false  
Get Payments
 page: integer 
    - Nullable: false
  size: integer 
    - Nullable: false
  sort: boolean
    - Nullable: true
Save Payment
    payment = {
        externalId: string,
        description: string,
        paymentCurrency: string,
        productCurrency: string,
        source: string,
        productAmount: float,
        buyerName: string,
        buyerEmailAddress : string,
        ipAddress: string,
        latitude: string,
        longitude: string,
        callback : {
            url : string,
            method : string,
            params : {
                orderID: string
            }
        },
        metadata :  {
            a : string
        }
    }
    - Nullable: false
Get Payment
 id: integer 
    - Nullable: false  
Update Payment
    update = {
        id: integer 
            - Nullable: false  
        values: { 
            externalId: string,
            description : string,
            metadata :  {
                "aaa" : "bbb"
            }
        }
    }
    - Nullable: false
Cancel Payment
 id: integer 
    - Nullable: false  
Add address
 data = {
        id: integer 
            - Nullable: false  
        address: { 
            paymentCurrency: string,
            productCurrency: string,
            productAmount: string
        }
    }
    - Nullable: false
Get Fees
  feeRequest = { 
            paymentCurrency: string,
            productCurrency: string,
            productAmount: string
        }
        
    }
    - Nullable: false