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.


Kiosk Pro Enterprise

  • 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.

  • numberOfDrawer - [integer] representing the number of the cash drawer to be opened:
    • 1 - primary cash drawer. This value should be used in the majority of use cases
    • 2 - secondary cash drawer
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.

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.

kp_StarPrinter_statusOfCashDrawerDidChange(isOnline, isOpened);
Return values
  • isOnline - [integer] indicating the current connection status of the cash drawer:
    • 1 - cash drawer is connected and correctly configured in Kiosk Pro settings
    • 0 - app is unable to communicate with cash drawer
  • isOpened - [integer] indicating whether the cash drawer is open:
    • 1 - cash drawer is currently open
    • 0 - cash drawer is currently closed

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.

Return values errorCode - [integer] indicating the current error state of the cash drawer:
  • 0 - no error returned
  • 1 - failure to open port
  • 2 - command to port timed out
  • 3 - cash drawer is offline

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

Still stuck? How can we help? How can we help?