Skip to content
This repository has been archived by the owner on May 31, 2022. It is now read-only.

studionone/sqid-pay-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQID Payments API wrapper

This project contains helper functions for accessing the SQID payments API

Deploying

The compiled files are included in this repo. Please ensure that you run npm run deploy before making a pull request so that latest files are built and the package-lock.json is updated with the new version number (Please update version number when making a PR for a new version)

Usage

Import

import { SQID } from 'sqid-pay-wrapper'

Initialise

This package has been implemented using a helper class which must be initialised before it can be used

const sqid = new SQID(apiKey, merchantCode, environmentBaseURI, passPhrase)

The required parameters to initialise the class are

Parameter Name Description
apiKey SQID API key
merchantCode SQID merchant code
environmentBaseURI SQID base url e.g https://api.staging.sqidpay.com
passPhrase (Optional) SQID secret pass phrase used for generating the hash. This is not required for all methods i.e getToken

Function calls

To use any of the available functions call the function on the initialised class, sending only the dynamic data for the customer/merchant. Below is an example of the getToken function:

const params = {
    cardNumber,
    cardExpiry,
    cardName,
    customerEmail,
    customerName,
    customerHouseStreet,
    customerSuburb,
    customerCity,
    customerState,
    customerCountry,
    customerPostCode,
}

this.SQID.getToken(params)
      .then(data => { ... })
      .catch(error => { ... })

Note: If a function only requires one parameter there is no need to pass an object, it will accept the parameter as a primitive type (string, number, etc.) e.g:

// One parameter
this.SQID.tokenInfo('981406061677')

// Multiple
this.SQID.getToken({ ...params })

Available functions

Please view the linked SQID documentation for further information for required parameters and any additional information about the function.

Function Accepts Documentation
getToken object https://sqidpay.atlassian.net/wiki/spaces/SRP/pages/1605679/getToken
tokenInfo string https://sqidpay.atlassian.net/wiki/spaces/SRP/pages/541130753/tokenInfo
processTokenPayment object https://sqidpay.atlassian.net/wiki/spaces/SRP/pages/1605704/processTokenPayment
getPaymentPage string https://sqidpay.atlassian.net/wiki/spaces/SRP/pages/544079873/Get+Payment+Page
payPaymentPage object https://sqidpay.atlassian.net/wiki/spaces/SRP/pages/544473089/Pay+with+Payment+Page