Android
The Kryptonim Android SDK is a library that allows you to easily integrate Kryptonim payments into your app. Use Android SDK repo from this project https://github.com/kryptonim-sdk/android
If you want to add Kryptonim payments to your app without using the SDK, you can do so using a browser. Check Android via browser
Installation
Add library repository to your root build.gradle:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Add dependency to desired build.gradle file:
dependencies {
implementation 'com.github.kryptonim-sdk:android:1.+'
}
Usage
Create an ActivityResultLauncher for KryptonimTransactionResultContract where you can take actions depending on the transaction result.
The result type is the TransactionResult enum, which has three possible values:
SUCCESS: transaction process finished with successFAILURE: transaction process finished with failureEXIT: transaction process intent was closed
private var kryptonimResultLauncher = registerForActivityResult(Kryptonim.createTransactionResultContract()) { result ->
when (result) {
TransactionResult.SUCCESS -> println("SUCCESS!")
TransactionResult.FAILURE -> println("FAILURE!")
TransactionResult.EXIT -> println("Kryptonim closed")
}
}
Create a KryptonimConfiguration object with all data you want to pass as parameters so your app user doesn’t have to fill them during transaction process.
All parameters and restrictions on their use can be checked here: Query parameters
val configuration = KryptonimConfiguration(Transaction(amount = "50", currency = FiatCurrency.EUR))
Launch created earlier launcher with configuration object:
kryptonimResultLauncher.launch(configuration)