This is a test environment for documentation.

Scanner Reader SDK

Prerequisites

For Sandbox (UAT):

Users should be onboarded on the iPOSpays sandbox (UAT) environment as a merchant and have a valid TPN.

For Production (Live):

Users should be onboarded on the iPOSpays production environment as a merchant and have a valid TPN.

If you do not have a TPN, contact your ISO or devsupport@dejavoo.io.

Sample Source code


Downloading the Scanner Reader SDK

  1. Locate the Peripheral_v1.0.aar file provided with your Scanner Reader kit.

  2. Copy the Peripheral_v1.0.aar file to your project directory.


Configuring Gradle Dependencies

Open your module-level build.gradle file and add the following inside the dependencies block:

implementation files "libs/Peripheral_v1.0.aar"

Synchronizing Gradle

  1. In Android Studio, click Sync Project with Gradle Files

  2. This ensures the SDK and dependencies are properly loaded into your project


Accessing the Scanner

Follow the steps below to initialize and use the scanner:

  1. Place the .aar file inside the libs folder of your project

  2. Add the dependency in the app-level build.gradle file:

implementation files 'libs/Peripheral_v1.0.aar'

Scanner Initialization

Use the following code to initialize the scanner. After initialization, configure callbacks to handle scan success and failure.

private lateinit var scannerActivity: ScannerActivity
 
if (Build.MODEL == "P18") {
    scannerActivity = ScannerActivity(this, iscanResult, SCAN_TIMEOUT)
} else {
    scannerActivity = ScannerActivity(iscanResult, SCAN_TIMEOUT)
}
 
private const val SCAN_TIMEOUT = 30000  

Callback Handling

Implement the callback interface to handle scan responses:

val iscanResult = object : IScannerResult {
 
    override fun onSuccess(result: String) {
        // Successful scan result
    }
 
    override fun onFailure(errorMessage: String) {
        // Error handling
    }
}

Start Scanning

Use the following code to begin scanning:

scannerActivity.startScan()

Stop Scanning

Use the following code to stop the scanner:

scannerActivity.stopScan()

Response

Example scan result:

result: P17B4250908000566