API: Control Cash Drawer Connected via Star Micronics Printer
Trigger or check the current status of a cash drawer connected through a Star Micronics printer.
In this article
Requirements
- Integration of our JavaScript API into your webpage
- Sample code to run within the app and download for integration into your own project is available here.
- Best practices for working with the JavaScript API are available here.
- App Settings
- Content > JavaScript API > Access JavaScript API = By Import
- Printing
- Enable Star Micronics Printer = On
- Star Micronics Printer Settings > Select Printer = select your printer or enter Port Name:
- if connecting via Wi-Fi = 'TCP:' + the IP address of the printer
- if connecting via Bluetooth = 'BT:' + name assigned to printer
- Star Micronics Printer Settings > Port Settings = 9100, unless specifically changed during printer set-up
- Physical Hardware
- Star Micronics thermal kiosk printer with a connected or built-in cash drawer (like the mPop). For a list of supported printers, click here.
- iOS/iPadOS Permissions
- Bluetooth (if using a Bluetooth-connected printer) - more on enabling specific iOS/iPadOS permissions here
Triggers via API Functions
Open Cash Drawer
This function triggers an attached cash drawer to open.
Format | kp_StarPrinter_openCashDrawer(numberOfDrawer); |
Parameters |
|
Triggers | Kiosk Pro will trigger one of the following callbacks depending on the status of the operation:
|
Check Cash Drawer Status
This function triggers a callback returning the current status of the cash drawer.
Format | kp_StarPrinter_requestCashDrawerStatus(); |
Triggers | Kiosk Pro will trigger one of the following callbacks depending on the status of the operation:
|
Notifications via API Callbacks
When the Cash Drawer Status Changes
This callback is triggered when the current state of the cash drawer changes or when the user calls kp_StarPrinter_openCashDrawer or kp_StarPrinter_requestCashDrawerStatus.
Format | kp_StarPrinter_statusOfCashDrawerDidChange(isOnline, isOpened); |
Return values |
|
When a Request to the Cash Drawer Fails
This callback is triggered when the cash drawer fails to respond following kp_StarPrinter_openCashDrawer or kp_StarPrinter_requestCashDrawerStatus.
Format | kp_StarPrinter_statusOfCashDrawerDidFailWithError(errorCode); |
Return values | errorCode - [integer] indicating the current error state of the cash drawer:
|
Sample Code
- This sample code relies on the JavaScript APIs built into Kiosk Pro and will not run successfully in other browsers or within our in-app help interface.
- To run sample code, set the app's homepage to kioskgroup.com/cash-drawer-api
- To download a .zip of sample code, click here.
Change Log
- Added in version 6.8