Cash Drawer SDK
The Cash Drawer SDK allows your Android application to open a connected cash drawer through a Dejavoo P18 payment terminal. This guide explains how to add the SDK to your project, configure the required dependency, and initialize the cash drawer in your application.
Prerequisites
- The host application should be listed on DvStore
- An iPOSpays-powered Dejavoo P18 payment terminal
- Access to the iPOSpays Portal (opens in a new tab)
- The Cash Drawer SDK (cashdrawer.aar (opens in a new tab)) provided with your cash drawer kit
For Sandbox (UAT)
- Be onboarded as a merchant in the iPOSpays Sandbox (UAT) environment
- Have a valid Sandbox TPN
For Production (Live)
- Be onboarded as a merchant in the iPOSpays Production environment
- Have a valid Production TPN
If you do not have a TPN, contact your ISO or devsupport@dejavoo.io.
Add the Cash Drawer SDK
Step 1. Copy the SDK
Locate the cashdrawer.aar file included with your Cash Drawer SDK package and copy it into your project's libs directory.
app/
└── libs/
└── cashdrawer.aarStep 2. Add the Dependency
Open your app-level build.gradle file and add the following dependency:
dependencies {
implementation files('libs/cashdrawer.aar')
}Step 3. Sync the Project
In Android Studio, select Sync Project with Gradle Files to load the SDK into your application.
Initialize the Cash Drawer
Create a CashDrawerOpener instance by detecting the connected device and returning the appropriate implementation.
fun create(): CashDrawerOpener? {
val opener = when {
isKozenP18Device() -> KozenP18CashDrawerOpener(context, cashDrawerLogger)
else -> null
}
if (opener != null) {
logger.info(
TAG,
"Resolved device cash drawer opener: ${opener.type}, exclusive=${isExclusiveDevice()}"
)
} else {
logger.debug(TAG, "No device-native cash drawer opener for this device")
}
return opener
}The SDK automatically checks whether the connected device is a supported P18 terminal and returns the appropriate CashDrawerOpener instance.
Open the Cash Drawer
After initializing the cash drawer, call the open() method to trigger the cash drawer.
opener?.open()