Android Kotlin
The dedicated Kotlin sample repository is a wrapper around the same Android library. For current Google Pay APIs, ProGuard rules, and compileSdk 37 requirements, follow the Android Library (Java) guide and call PaymentActivity from Kotlin as shown below.
Repository: Mobile_XDK_Fiuu_Android_Kotlin
Requirements
| Requirement | Version |
|---|---|
compileSdk | 37+ (required by underlying library 3.34.41+) |
targetSdkVersion | 37+ |
minSdkVersion | 26+ |
| Android Gradle Plugin | 9.1.1+ |
| JDK | 17 |
Installation
- Create a new Kotlin project (or add Kotlin to an existing Android project).
- Ensure JitPack is in your root
build.gradlerepositories:
allprojects {
repositories {
mavenCentral()
google()
maven { url 'https://jitpack.io' }
}
}
- Add the dependency in
build.gradle(Module :app):
implementation 'com.github.FiuuPayment:Mobile_XDK_Fiuu_Android_Kotlin:<tag>'
- Sync the project.
Basic Integration
Import the Fiuu XDK classes:
import com.fiuu.xdk.PaymentActivity
Register the activity result launcher in onCreate:
startForResult = registerForActivityResult(
ActivityResultContracts.StartActivityForResult()
) { result ->
if (result.resultCode == Activity.RESULT_OK && result.data != null) {
val transactionResult = result.data!!
.getStringExtra(PaymentActivity.XDKTransactionResult)
Log.d(PaymentActivity.logXDK, "transaction result = $transactionResult")
}
}
Start payment:
private fun startPaymentXDK() {
val paymentDetails: HashMap<String, Any> = HashMap()
paymentDetails[PaymentActivity.mp_amount] = "1.01"
paymentDetails[PaymentActivity.mp_username] = ""
paymentDetails[PaymentActivity.mp_password] = ""
paymentDetails[PaymentActivity.mp_merchant_ID] = ""
paymentDetails[PaymentActivity.mp_app_name] = "mobile"
paymentDetails[PaymentActivity.mp_verification_key] = ""
paymentDetails[PaymentActivity.mp_order_ID] = Calendar.getInstance().timeInMillis
paymentDetails[PaymentActivity.mp_currency] = "MYR"
paymentDetails[PaymentActivity.mp_country] = "MY"
paymentDetails[PaymentActivity.mp_channel] = "multi"
paymentDetails[PaymentActivity.mp_bill_description] = "bill description"
paymentDetails[PaymentActivity.mp_bill_name] = "bill name"
paymentDetails[PaymentActivity.mp_bill_email] = "email@domain.com"
paymentDetails[PaymentActivity.mp_bill_mobile] = "123456789"
paymentDetails[PaymentActivity.mp_channel_editing] = false
paymentDetails[PaymentActivity.mp_editing_enabled] = false
paymentDetails[PaymentActivity.mp_express_mode] = false
paymentDetails[PaymentActivity.mp_dev_mode] = false
val intent = Intent(this@MainActivity, PaymentActivity::class.java)
intent.putExtra(PaymentActivity.XDKPaymentDetails, paymentDetails)
startForResult.launch(intent)
}
Trigger from a button:
binding.fab.setOnClickListener {
startPaymentXDK()
}
Payment results are returned as a JSON string via PaymentActivity.XDKTransactionResult. Parse and verify on your backend — see Response Handling.
Google Pay
For Google Pay integration (express mode via ActivityGP, mp_gpay_channel, production access requirements), see the Android Library (Java) guide. The underlying API is the same; only the calling language differs.
Payment Parameters
See Payment Parameters for the full list of mp_* parameters.
Related Guides
- Android Library (Java) — Java variant with Google Pay details
- Deeplink Setup
- Response Handling
- Core Integration