<<

SwipeTrack Browser API Revision 2.0.0

SwipeTrack Browser API Table of Contents

Table of Contents

Introduction ...... 4 Release Notes ...... 4 Supported Devices ...... 5 Readers & Magnetic Stripe Readers (MSR) ...... 5 Printers ...... 5 Radio Frequency Identification (RFID) Readers ...... 5 JavaScript Interface ...... 6 Functions ...... 6 stBrowserDidScanBarcode ...... 6 Magnetic Stripe Reader (MSR) Functions ...... 6 stBrowserDidReadCardData ...... 6 stBrowserDidReadEncryptedCardData ...... 6 stBrowserDidReadFinancialCardData ...... 7 Radio Frequency Identification (RFID) Functions ...... 7 stBrowserDidDetectRFCard ...... 7 stBrowserDidReadRFCard ...... 7 stBrowserDidReadRFCard ...... 8 stBrowserShouldCloseRFCardOnDetect ...... 8 Miscellaneous Functions ...... 9 stBrowserDidCapturePicture ...... 9 stBrowserDidCaptureSignature ...... 9 URI Scheme ...... 10 Barcode Reader Functions ...... 10 stBrowser://startBarcodeScanner ...... 10 stBrowser://startCameraScanner ...... 10 stBrowser://stopBarcodeScanner ...... 10 stBrowser://stopCameraScanner ...... 10 Browser Functions ...... 11 stBrowser://capturePicture ...... 11 stBrowser://captureSignature ...... 11 stBrowser://clearCredentials ...... 11 stBrowser://closeTab ...... 11 stBrowser://getAppSettings?callback=@CALLBACK ...... 12 stBrowser://getLastLaunchedTime?callback=@CALLBACK ...... 12 stBrowser://openTab?url=@URL ...... 12 stBrowser://playSound?sound=@SOUND ...... 12 stBrowser://quitApplication?msg=@MSG ...... 13 stBrowser://setAddressBarHidden?hidden=@HIDDEN ...... 13 stBrowser://setAppSettings?settings=@SETTINGS ...... 13 stBrowser://setHomePage?page=@PAGE ...... 13 stBrowser://setNavigationBarHidden?hidden=@HIDDEN ...... 13 stBrowser://vibrateDevice?count=@COUNT ...... 14 Print Functions ...... 14 stBrowser://printHtml?=@HTML ...... 14 stBrowser://printText?text=@TEXT ...... 14 stBrowser://printHtml?url=@URL ...... 14 Revision 2.0.0 2 SwipeTrack Browser API Table of Contents Radio Frequency Identification (RFID) Functions ...... 14 stBrowser://closeRFCard?index=@INDEX ...... 14 stBrowser://readRFCard?index=@INDEX&addr=@ADDR&len=@LEN ...... 15 stBrowser://readRFCard?index=@INDEX&app=@APP&file=@FILE&len=@LEN ...... 15 Reference ...... 16 Table 1: Barcode Type Enumeration ...... 16 Table 2: Magnetic Card Encryption Type Enumeration ...... 17 Table 3: RFID Card Type Enumeration ...... 17 Table 4: Browser Settings Object Properties ...... 17 Table 5: Browser Sound Files ...... 18 Table 6: Encrypted Magnetic Card Properties ...... 18

Revision 2.0.0 3 SwipeTrack Browser API Introduction Introduction

This document outlines how to integrate a website with the SwipeTrack Browser API. The API outlined in this document allows websites that implement it to communicate with supported hardware devices through the SwipeTrack Browser application.

Release Notes Version Date Changes 1.0.0 5/20/2014 Initial document release 1.0.1 6/12/2014 Added the section on User Defined Callbacks 1.0.2 7/15/2014 Added “stBrowser://printURL?url=@URL” function Added Star Micronics TSP100 to supported devices list Deprecated “stBrowser://airPrint?url=@URL” function 1.0.3 8/26/2014 Added methods for capturing a user signature Added “msrRawEncryptionData” to Table 5 1.1.0 12/23/2014 Added “stBrowserCacheStoragePolicy” to Table 4 1.1.1 1/6/2015 Added methods for capturing a picture 1.1.2 1/29/2015 Updated Supported Devices list Updated “stBrowser://printBarcode” function with new support 2.0.0 2/28/2017 Rebuilt document for release of SwipeTrack Browser v6.0.0

Revision 2.0.0 4 SwipeTrack Browser API Supported Devices Supported Devices

Barcode Readers & Magnetic Stripe Readers (MSR) • Cognex MX1000 – http://www.cognex.com/programs/mx-1000 • Honeywell Captuvo – https://www.honeywellaidc.com/products/enterprise-sleds/captuvo • Infinite Peripherals Linea Pro & Infinea Models – https://ipcmobile.com/products/ios-peripherals • Socket Mobile CHS Series 7 & 8 – https://www.socketmobile.com/products

Printers • Blue Bamboo PocketPOS P25 – http://www.bluebamboo.com/p25.php • Infinite Peripherals DPP Series – https://ipcmobile.com/products/accessories/?p=mobile-printers • Star Micronics SM Series – http://www.starmicronics.com/printer/portable_printers

Radio Frequency Identification (RFID) Readers • Infinite Peripherals Linea Pro & Infinea Models – https://ipcmobile.com/products/ios-peripherals

Revision 2.0.0 5 SwipeTrack Browser API JavaScript Interface JavaScript Interface

The first part of the SwipeTrack Browser API is the JavaScript interface. Whenever the SwipeTrack Browser application detects certain events, e.g. a barcode scan or a card swipe, it will communicate that information to the client through several callback functions you implement within your website.

Barcode Reader Functions stBrowserDidScanBarcode

Description: Called after a successful barcode scan

Parameters: type(integer) – type of barcode scanned. See Table 1 for a complete list of barcode types. data(string) – decoded data from scanned barcode. stid(string) – unique device .

Magnetic Stripe Reader (MSR) Functions stBrowserDidReadCardData

Description: Called after a successful magnetic card swipe. Note: This function is only called when a card is swiped using an unencrypted MSR head.

Parameters: track1(string) – decoded track 1 data from swiped magnetic card. track2(string) – decoded track 2 data from swiped magnetic card. track3(string) – decoded track 3 data from swiped magnetic card. stid(string) – unique device identifier. stBrowserDidReadEncryptedCardData

Description: Called after a successful magnetic card swipe. Note: This function is only called when a card is swiped using an encrypted MSR head.

Parameters: type(integer) – encryption type. See Table 2 for a complete list of encryption types data(object) – encrypted data object. See Table 6 for a complete list of properties stid(string) – unique device identifier.

Revision 2.0.0 6 SwipeTrack Browser API JavaScript Interface stBrowserDidReadFinancialCardData

Description: Called after a successful credit/debit card swipe. Note: This function is only called when a card is swiped using an unencrypted MSR head.

Parameters: acct(string) – account number. chName(string) – card holder full name. expMonth(integer) – expiration month. expYear(integer) – expiration year. fName(string) – card holder first name. lName(string) – card holder last name. stid(string) – unique device identifier.

Radio Frequency Identification (RFID) Functions stBrowserDidDetectRFCard

Description: Called after a supported RF chip enters the range of the RFID reader.

Parameters: index(integer) – index of the detected RF card. type(integer) – type of RF card detected. See Table 3 for a complete list of RF card types. serial(string) – serial number of the detected RF card. stid(string) – unique device identifier. stBrowserDidReadRFCard

Description: Called after an RF card has been successfully read. Note: This function is called when an RF card of one of the following types is read: § MIFARE Classic 1K/4K § MIFARE Mini § MIFARE Plus § MIFARE Ultralight/Ultralight C

Parameters: index(integer) – index of the read RF card. address(integer) – address of the read data from within the RF card. length(integer) – length of read data. data(string) – data that was read from the RF card. stid(string) – unique device identifier.

Revision 2.0.0 7 SwipeTrack Browser API JavaScript Interface stBrowserDidReadRFCard

Description: Called after an RF card has been successfully read. Note: This function is called when an RF card of one of the following types is read: § MIFARE DESFire

Parameters: index(integer) – index of the read RF card. application(integer) – application of the read data from within the RF card. fileId(integer) – file ID of the read data from within the RF card. length(integer) – length of read data. data(string) – data that was read from the RF card. stid(string) – unique device identifier. stBrowserShouldCloseRFCardOnDetect

Description: Called after a supported RF chip enters the range of the RFID reader. This function should simply return true or false. If true is returned the application will immediately close any RF card that comes into range for further reading. The stBrowserDidDetectRFCard method will still be called with the RF card info. If false is returned the application will leave the RF card open for further reading, however no new RF cards can be detected until the open card is closed.

Note: This function is not required to be implemented. If omitted, SwipeTrack Browser assumes true is returned by default and will close all RF cards after reading their serial. This function is only required if you need to read data from an RF card beyond just the serial.

Parameters: No parameters.

Revision 2.0.0 8 SwipeTrack Browser API JavaScript Interface

Miscellaneous Functions stBrowserDidCapturePicture

Description: Called after the user captures a picture with the iOS device camera.

Parameters: picture(string) – base 64 representation of the image captured. Image is PNG format. stid(string) – unique device identifier. stBrowserDidCaptureSignature

Description: Called after the user provides their signature.

Parameters: signature(string) – base 64 representation of the signature. Image is PNG format. stid(string) – unique device identifier.

Revision 2.0.0 9 SwipeTrack Browser API URI Scheme URI Scheme

The second part of the SwipeTrack Browser API is the URI interface. In order for websites to communicate with and make requests to the SwipeTrack Browser, it responds to requests from a unique URI scheme. This URI is used by formatting a URI string in accordance with one of the supported functions below, then setting the window.location property within JavaScript to point to the formatted URI.

Barcode Reader Functions stBrowser://startBarcodeScanner

Description: Immediately attempts to start the attached barcode scanner.

Parameters: No Parameters. stBrowser://startCameraScanner

Description: Immediately attempts to start the camera barcode scanner.

Parameters: No Parameters. stBrowser://stopBarcodeScanner

Description: Immediately attempts to stop the attached barcode scanner.

Parameters: No Parameters. stBrowser://stopCameraScanner

Description: Immediately attempts to stop the camera barcode scanner.

Parameters: No Parameters.

Revision 2.0.0 10 SwipeTrack Browser API URI Scheme

Browser Functions stBrowser://capturePicture

Description: Presents the default iOS image capture screen. Upon successfully capturing a picture, the stBrowserDidCapturePicture method will be called.

Parameters: No Parameters. stBrowser://captureSignature

Description: Presents the user with a signature pad. Upon successfully capturing a signature, the stBrowserDidCaptureSignature method will be called.

Parameters: No Parameters. stBrowser://clearCredentials

Description: Removes the following types of data from storage: § Cookies § On-disk caches § IndexedDB databases § HTML local storage § In-memory caches § HTML offline web application caches § HTML session storage § WebSQL databases

Parameters: No Parameters. stBrowser://closeTab

Description: Causes SwipeTrack Browser to close the current web tab.

Parameters: No Parameters.

Revision 2.0.0 11 SwipeTrack Browser API URI Scheme stBrowser://getAppSettings?callback=@CALLBACK

Description: When this function is called SwipeTrack Browser will build a JavaScript object containing all of the current application settings. This object will then be passed to a callback provided by the website. Note: See Table 4 for a complete list of properties the settings object can contain.

Parameters: @CALLBACK(string) – name of function to receive settings object. This function must take exactly 2 parameters; the first parameter will be the settings object and the second parameter will be the unique device identifier. stBrowser://getLastLaunchedTime?callback=@CALLBACK

Description: This function will return a formatted string containing a timestamp when SwipeTrack Browser was last opened.

Parameters: @CALLBACK(string) – name of function to receive timestamp. This function must take exactly 2 parameters; the first parameter will be the timestamp string and the second parameter will be the unique device identifier. stBrowser://openTab?url=@URL

Description: Causes SwipeTrack Browser to open a new web tab.

Parameters: @URL(string) – URL of website to load in the new tab. If this parameter is omitted, SwipeTrack Browser will open a new tab and load the stored home page. stBrowser://playSound?sound=@SOUND

Description: Plays a sound through the iOS device speakers.

Parameters: @SOUND(string) – name of the sound to play. See Table 5 for a complete list of sounds

Revision 2.0.0 12 SwipeTrack Browser API URI Scheme stBrowser://quitApplication?msg=@MSG

Description: Prompts the user to quit the SwipeTrack Browser application.

Parameters: @MSG(string) – the message to display to the user with the quit prompt stBrowser://setAddressBarHidden?hidden=@HIDDEN

Description: Sets the visibility of the address bar in the SwipeTrack Browser.

Parameters: @HIDDEN(string) – this parameter must be a string containing either “true” or “false” stBrowser://setAppSettings?settings=@SETTINGS

Description: SwipeTrack Browser will parse the contents of the settings object and update most current application settings to the provided values. Note: See Table 4 for a complete list of properties the settings object can contain.

Parameters: @SETTINGS(string) – JSON representation of the settings object. Can be obtained by using the JSON.stringify JavaScript method. stBrowser://setHomePage?page=@PAGE

Description: Sets the visibility of the navigation bar in the SwipeTrack Browser.

Parameters: @PAGE(string) – URL of the website to store as the home page stBrowser://setNavigationBarHidden?hidden=@HIDDEN

Description: Sets the visibility of the navigation bar in the SwipeTrack Browser.

Parameters: @HIDDEN(string) – this parameter must be a string containing either “true” or “false”

Revision 2.0.0 13 SwipeTrack Browser API URI Scheme stBrowser://vibrateDevice?count=@COUNT

Description: Attempts to vibrate the iOS device a given number of times. If the iOS device does not support vibration, calling this will have no effect.

Parameters: @COUNT(integer) – number of times to vibrate the device

Print Functions stBrowser://printHtml?html=@HTML

Description: Renders the provided HTML into an image and prints it.

Parameters: @HTML(string) – raw HTML (including CSS styling) to render and print stBrowser://printText?text=@TEXT

Description: Renders the provided text into an image and prints it.

Parameters: @TEXT(string) – text string to render and print stBrowser://printUrl?url=@URL

Description: Renders the provided URL into an image and prints it.

Parameters: @URL(string) – URL of website to render and print

Radio Frequency Identification (RFID) Functions stBrowser://closeRFCard?index=@INDEX

Description: Closes the RF card located at the provided index for further reading.

Parameters: @INDEX(integer) – index of RF card to close

Revision 2.0.0 14 SwipeTrack Browser API URI Scheme stBrowser://readRFCard?index=@INDEX&addr=@ADDR&len=@LEN

Description: Attempts to read data stored on an RF card at the requested address. Note: Be sure any required RF card keys are set prior to calling this function

Parameters: @INDEX(integer) – index of RF card to read @ADDR(integer) – address of the data to read within the RF card @LEN(integer) – length of the data to read within the RF card stBrowser://readRFCard?index=@INDEX&app=@APP&file=@FILE&len=@LEN

Description: Attempts to read data stored on an RF card at the requested address. Note: Be sure any required RF card keys are set prior to calling this function

Parameters: @INDEX(integer) – index of RF card to read @APP(integer) – app area of the data to read within the RF card @FILE(integer) – file ID of the data to read within the RF card @LEN(integer) – length of the data to read within the RF card

Revision 2.0.0 15 SwipeTrack Browser API Reference Reference

Table 1: Barcode Type Enumeration Value Barcode Type 1 2 3 Code 25 4 Code 25 Non-Interleaved 2 of 5 5 6 7 8 CPC Binary 9 EAN 2 10 EAN 5 11 EAN 8 12 EAN 13 13 FIM 14 GS1 128 15 GS1 Databar 16 Intelligent 17 ITF 14 18 KIX 19 Modified 20 MTF 21 22 Planet 23 Plessey 24 Postbar 25 Postnet 26 RM4SCC 27 28 UPC 2 29 UPC 5 30 UPC A 31 UPC B 32 UPC C 33 UPC D 34 UPC E 1000 Aztec 1001 Cybercode 1002 Data Glyph 1003 1004 Data Strip

Revision 2.0.0 16 SwipeTrack Browser API Reference

1005 EZ Code 1006 Maxicode 1007 Micro PDF417 1008 Micro QRCode 1009 PDF417 1010 Qode 1011 QRCode 1012 Shot Code 1013 Sparq Code 9999 Unknown

Table 2: Magnetic Card Encryption Type Enumeration Value Encryption Type 1 AES 128 2 AES 256 3 ECC 4 IDTech 5 IDTech AES 128 6 Magtek 7 Magtek AES 128 8 RSA 9 3DES 9999 Unknown

Table 3: RFID Card Type Enumeration Value RFID Card Type 1 MIFARE Classic 1K 2 MIFARE Classic 4K 3 MIFARE DESFire 4 MIFARE Mini 5 MIFARE Plus 6 MIFARE Ultralight 7 MIFARE Ultralight C 9999 Unknown

Table 4: Browser Settings Object Properties Property Name Description browser.addressBarVisible Boolean indicating the visibility of the address bar browser.barcodeDirectInputEnabled Boolean indicating if barcode direct input is enabled browser.connectionMonitorEnabled Boolean indicating if the connection monitor is enabled browser.homePage Full URL string representing the default or “home” page browser.javascriptEnabled Boolean indicating whether JavaScript is enabled browser.lastLaunchedTime READONLY – timestamp when Browser was last launched

Revision 2.0.0 17 SwipeTrack Browser API Reference

browser.navigationBarVisible Boolean indicating the visibility of the navigation bar browser.resetOnResumeEnabled Boolean indicating if reset on resume is enabled browser.searchProvider String representing the current address bar search provider browser.uniqueDeviceIdentifier String containing a unique device identifier hardware.captuvo.barcodeScanBeepEnabled Boolean controlling the audible barcode scan beep hardware.iOS.barcodeScanBeepEnabled Boolean controlling the audible barcode scan beep hardware.iOS.barcodeScanEnabled Boolean indicating if barcode scanning enabled hardware.iOS.deviceSleepDisabled Boolean indicating if the iOS device should remain awake hardware.iOS.imageCaptureQuality String representing the image capture quality hardware.iOS.msrScanEnabled Boolean indicating if credit card scanning enabled hardware.ipc.barcodeScanMode String representing the current barcode scan mode hardware.ipc.barcodeScanBeepEnabled Boolean controlling the audible barcode scan beep hardware.ipc.batteryEnabled Boolean indicating if scan sled should charge the iOS device hardware.ipc.fastChargingEnabled Boolean indicating if fast charging is enabled hardware.ipc.kioskModeEnabled Boolean indicating if kiosk mode is enabled hardware.ipc.passThroughSyncEnabled Boolean indicating if pass through sync is enabled hardware.ipc.rfidEnabled Boolean indicating if RF reading is enabled hardware.ipc.idleTimeout Number of seconds before scan sled goes idle hardware.ipc.mifareKey String representing the RF MIFARE key hardware.ipc.mifareUltralightKey String representing the RF MIFARE Ultralight key

Table 5: Browser Sound Files Sound Name attention error success

Table 6: Encrypted Magnetic Card Properties Property Name Description msrRawEncryptionData Base64 representation of the unmodified encryption data

Revision 2.0.0 18