Skip to main content
Version: Express SDK 1.3

Javascript Methods

initHapiExpress

Creates an instance of Hapi.

Parameters

ParameterNotes
client_id Required
string
A unique identifier of your system to group operations.
ssk Required
string
The shared secret key to authorize the operations.
auto_return Required
Boolean
If true, Handpoint Express automatically switches back to your app following a short timeout after the transaction completes.

Code Example

initHapiExpress('hapi-tests', '010203040050606', false);

Returns

ParameterNotes
objectThe Hapi interface object with functions to generate URLs for sale, refund and reversals.

openURL

Opens a URL that is passed. This is a helper method. URLs generated by the UrlFor... methods can also be opened just like a normal link.

Parameters

ParameterNotes
url Required
string
Url to open

Code Example

Hapi.openURL('handpoint://express/v1/?data=')

urlForRefund

Constructs the URL needed for opening the express app and starting a refund operation.

ParameterNotes
amount Required
integer
Amount of funds to charge - in the minor unit of currency (f.ex. 1000 is 10.00 GBP)
currency Required
string
Currency of the charge
extra_parameters Required
object
An object containing additional sale parameters, fx. Key: "Budget", Value: "03"
callbacl_url Required
string
The URL that Handpoint Express will send its response to.

Code Example

Hapi.urlForRefund('1000', 'USD', {'extra-value':'some info'}, 'http://callback.com');

Returns

ParameterNotes
StringA complete constructed and encoded URL string that includes the data for opening the express app and performing the operation.

urlForRefundReversal

Constructs the URL needed for opening the express app and reverting a refund transaction. This operation tries to void an earlier refund transaction, therefor the transaction GUID is needed for the transaction to be voided.

ParameterNotes
amount Required
integer
Amount of funds to charge - in the minor unit of currency (f.ex. 1000 is 10.00 GBP)
currency Required
string
Currency of the charge
originalTransactionID Required
string
The transaction id number for the transactino to void/revert
extra_parameters Required
object
An object containing additional sale parameters, fx. Key: "Budget", Value: "03"
callbacl_url Required
string
The URL that Handpoint Express will send its response to.

Code Example

Hapi.urlForRefundReversal('1000', 'USD', '1234' {'extra-value':'some info'}, 'http://callback.com');

Returns

ParameterNotes
StringA complete constructed and encoded URL string that includes the data for opening the express app and performing the operation.

urlForSale

Constructs the URL needed for opening the express app and starting a sale.

ParameterNotes
amount Required
integer
Amount of funds to charge - in the minor unit of currency (f.ex. 1000 is 10.00 GBP)
currency Required
string
Currency of the charge
extra_parameters Required
object
An object containing additional sale parameters, fx. Key: "Budget", Value: "03"
callbacl_url Required
string
The URL that Handpoint Express will send its response to.

Code Example

Hapi.urlForSale('1000', 'USD', {'extra-value':'some info'}, 'http://callback.com');

Returns

ParameterNotes
StringA complete constructed and encoded URL string that includes the data for opening the express app and performing the operation.

urlForSaleAndTokenizeCard

Constructs the URL needed for opening the express app and starting a saleAndTokenizeCard

ParameterNotes
amount Required
integer
Amount of funds to charge - in the minor unit of currency (f.ex. 1000 is 10.00 GBP)
currency Required
string
Currency of the charge
extra_parameters Required
object
An object containing additional sale parameters, fx. Key: "Budget", Value: "03"
callbacl_url Required
string
The URL that Handpoint Express will send its response to.

Code Example

Hapi.urlForSaleAndTokenizeCard('1000', 'USD', {'extra-value':'some info'}, 'http://callback.com');

Returns

ParameterNotes
StringA complete constructed and encoded URL string that includes the data for opening the express app and performing the operation

urlForSaleReversal

Constructs the URL needed for opening the express app and reverting a sale transaction. This operation tries to void an earlier sale transaction, therefor the transaction GUID is needed for the transaction to be voided.

ParameterNotes
amount Required
integer
Amount of funds to charge - in the minor unit of currency (f.ex. 1000 is 10.00 GBP)
currency Required
string
Currency of the charge
extra_parameters Required
object
An object containing additional sale parameters, fx. Key: "Budget", Value: "03"
originalTransactionID Required
string
The transaction id number for the transactino to void/revert
callbacl_url Required
string
The URL that Handpoint Express will send its response to.

Code Example

Hapi.urlForSaleReversal('1000', 'USD', '1234' {'extra-value':'some info'}, 'http://callback.com');

Returns

ParameterNotes
StringA complete constructed and encoded URL string that includes the data for opening the express app and performing the operation.

urlForScanner

Constructs the URL needed for opening the express app and starting scanning.

ParameterNotes
multiScan Required
boolean
True if you want the scanner to stay on to capture multiple codes. False to shut off after the first succesful scan, timeout or cancel. Default is False
autoScan Required
boolean
True if you want the scanner to function automatically without the press of a button. Default is False.
resultsGrouped Required
boolean
True if you want the results of the scan to come all grouped when the scanner is turned off. Otherwise the device will send an event per each code scanned. Default is True.
timeout Required
integer
The amount of seconds after which the scanner, if left idle, turns itself off. Default is 0.
extra_parameters Required
object
An object containing additional sale parameters, fx. Key: "Budget", Value: "03"
callback_url Required
string
The URL that Handpoint Express will send its response to.

Code Example

Hapi.urlForScanner(false, false, true, 0, {'extra-value':'some info'}, 'http://callback.com');

Returns

ParameterNotes
StringA complete constructed and encoded URL string that includes the data for opening the express app and performing the operation.

urlForTokenizeCard

Constructs the URL needed for opening the express app and starting a tokenizeCard.

ParameterNotes
extra_parameters Required
object
An object containing additional sale parameters, fx. Key: "Budget", Value: "03"
callback_url Required
string
The URL that Handpoint Express will send its response to.

Code Example

Hapi.urlForTokenizeCard({'extra-value':'some info'}, 'http://callback.com');

Returns

ParameterNotes
StringA complete constructed and encoded URL string that includes the data for opening the express app and performing the operation.