Set up
Before processing payments or performing any other operations with the ePOS Unified SDK, you must first initialize the SDK.
Follow the steps below to properly initialize and prepare the SDK for use in your Android project:
1. Create the AllInOneSDK Instance
To set up the All-in-One SDK in your Android project, create an instance of AllInOneSDK by calling TeyaAllInOneSDK function.
You'll need to provide a MissedResponseListener, which is explained in detail in the Missed Responses section.
Kotlin
val teyaAllInOneSDK = TeyaAllInOneSDK(
onMissedResponseListener = object : MissedResponseListener {
// ..
},
logger = LoggerImpl(),
eposInstanceId = null // Optional: identifier for your ePOS app instance
)2. Add Custom Logging
To enable logging, you can pass a custom logger by implementing the Logger interface.
Kotlin
class LoggerImpl : Logger {
override fun d(message: String) {
Log.d("SDK", message)
}
override fun i(message: String) {
Log.i("SDK", message)
}
override fun w(message: String) {
Log.w("SDK", message)
}
override fun e(message: String) {
Log.e("SDK", message)
}
}| Symbol | Level | Description |
|---|---|---|
d |
Debug | Detailed information used for diagnosing issues. Typically disabled in production. |
i |
Info | General operational messages that highlight system progress. |
w |
Warning | An indication that something unexpected happened, but the app can continue running. |
e |
Error | A serious issue that has caused part of the application to fail. |
These log levels help you filter and understand the behavior of the SDK or your application.
3. Initialize the Transactions API
Use setupTransactionsApi to initialize the SDK. You must retain the TeyaCommonTransactionsApi instance for all future SDK operations.
Kotlin
val teyaIntegration = teyaAllInOneSDK.setupTransactionsApi(
skipApprovedScreen = false, // Optional: Show the approved screen after successful payment
allowPaymentAppTips = true, // Optional: Enable tipping on the payment app
showReceiptOptionsOnPaymentApp = false // Optional: Do not show receipt options on the payment app
)