Skip to content

Latest commit

 

History

History
211 lines (160 loc) · 5.82 KB

README.md

File metadata and controls

211 lines (160 loc) · 5.82 KB
title description
Poynt
Work with Poynt Payment Fragment, SecondScreen Service, Business Service

cordova-plugin-poynt

This plugin defines a global Poynt object, which provides an API for working with Poynt Payment Fragment, SecondScreen and Business services.

Installation

The plugin was written and tested using with cordova v6.3.0

cordova plugin add cordova-plugin-poynt

It is also possible to install via repo url directly

cordova plugin add https://github.com/poynt/cordova-plugin-poynt.git

How to Contribute

Please feel free to contribute. You can report bugs, improve the documentation, or contribute code.


API Reference


Poynt

Poynt.launchPayment(amount, referenceId, successCallback, errorCallback)

Launches Payment Fragment with the payment amount as amount. The transaction response passed to the success callback as a JSON object.

Supported Platforms

  • PoyntOS
Param Type Description
amount long (e.g. 755 would translate to $7.55 payment amount
referenceId String referenceId return in transaction response
successCallback
errorCallback

Example Request

Poynt.launchPayment(777, 'myRefId', succcessCallback, failureCallback);

Example Response

{
   "transactions": [
     {
       "action": "SALE",
       "amounts": {
         "cashbackAmount": 0,
         "currency": "USD",
         "customerOptedNoTip": false,
         "orderAmount": 777,
         "tipAmount": 0,
         "transactionAmount": 777
     },
       "fundingSource": {
         "type": "CASH"
        },
       "id": "abb0093c-2e3e-4500-9b16-658ec2eb8287",
       "references": [
         {
           "customType": "referenceId",
           "id": "myRefId",
           "type": "CUSTOM"
         }
       ],
       "status": "CAPTURED"
     }
    ],
   "status": "COMPLETED",
   "currency": "USD",
   "referenceId": "myRefId",
   "amount": 777,
   "tipAmount": 0,
   "cashbackAmount": 0,
   "disableDebitCards": false,
   "disableCash": false,
   "debit": false,
   "disableTip": false,
   "cashOnly": false,
   "nonReferencedCredit": false,
   "authzOnly": false,
   "multiTender": false
}

Poynt.secondScreen.collectAgreement(successCallback, errorCallback,options)

Launches secondScreenService->captureAgreement passing msg as URL. "YES" or "NOT" strings are passed back in callback. In case of error, errorCallback is called with error string in argument

Supported Platforms

  • PoyntOS
Param Type Description
successCallback
errorCallback
options JSON parameters: msg

Example Request

Poynt.secondScreen.collectAgreement( succcessCallback, failureCallback,{"msg":'http://example.com/privacy.html');

Poynt.secondScreen.collectSignature(successCallback, errorCallback,options)

Launches secondScreenService->captureSignature passing title, button name (only for Accept behaviour) and message. In case of success the function returns a base64 string that represents the bitmap bytestream of the signature as argument in successCallback. In case of error an error string in errorCallback.

Supported Platforms

  • PoyntOS
Param Type Description
successCallback
errorCallback
options JSON parameters: title,leftbutton,msg

Example Request

Poynt.launchSign(succcessCallback, failureCallback,{"title":'Confirm by sign',"leftbutton":'Signed',"msg":'by signing you agree...'});

Poynt.Init(successCallback, errorCallback)

This function initialize services for Business and SecondScreen services. In case of error a string is returned in errorCallback

Supported Platforms

  • PoyntOS
Param Type Description
successCallback
errorCallback

Example Request

Poynt.Init(succcessCallback, failureCallback);

Poynt.secondScreen.displayMessage(successCallback, errorCallback,options)

Launches secondScreenService->displayMessage passing the msg as parameter.

Supported Platforms

  • PoyntOS
Param Type Description
successCallback
errorCallback
options JSON parameters: msg

Example Request

Poynt.secondScreen.displayMessage(succcessCallback, failureCallback,{"msg":'a message in second screen'});

Poynt.business.getBusiness(successCallback, errorCallback)

Launches businessService->getBusiness. The response is passed to the success callback as a JSON object. In case of error a string is passed in errorCallback

Supported Platforms

  • PoyntOS
Param Type Description
successCallback
errorCallback

Example Request

Poynt.business.getBusiness(succcessCallback, failureCallback);

Example Response

{
   "name": "My Business Name",
   "email": "email@email....",
   "phone": "021223-.....",
   "mcc": "8099" 
}