payger-merchant-sdk

Payger Merchant API SDK

no
Last updated a year ago by payger .
ISC · Original npm · Tarball · package.json
$ cnpm install payger-merchant-sdk 
SYNC missed versions from official npm registry.

PAYGER - Merchant SDK

PAYGER - Merchant SDK

Welcome to our merchant sdk github tutorial.

What is this SDK?

Javascript SDK to easily connect to Payger Merchant API.

Here can find the API documentation.

Instalation

Node.js

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

$ npm install payger-merchant-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

Current Tags

  • 1.0.6                                ...           latest (a year ago)

6 Versions

  • 1.0.6 [deprecated]           ...           a year ago
  • 1.0.5 [deprecated]           ...           a year ago
  • 1.0.4 [deprecated]           ...           a year ago
  • 1.0.2 [deprecated]           ...           a year ago
  • 1.0.1 [deprecated]           ...           a year ago
  • 1.0.0 [deprecated]           ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 2
Last Month 10
Dependencies (0)
None
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |