Falu's Android SDK simplifies the process of building excellent financial services into Android applications. We expose APIs that will enable to you to make payment and handle identity verification.
- Android 5.0 (API level 21) and above
- [Android Gradle Plugin] (https://developer.android.com/studio/releases/gradle-plugin) 4.2.2
Add falu
to your build.gradle
dependencies.
implementation "io.falu:falu-android:VERSION_NUMBER"
Get started with our Setup Guide.
Create an instance Falu
since its the entry point to SDK
val falu = Falu(this, "PUBLIC_KEY")
The public key is mandatory. Failing to provide it will result
into an Exception
when interacting with Falu.
You can also enable logging of network operations as follows:
val falu = Falu(this, "PUBLIC_KEY", true)
NOTE: It is recommended to disable logging in production
Once you have finished the setup process, you can proceed to use the features and functionalities offered by the SDK
Create a Payment
object when initiating payments from a customer. Falu supports several payment
methods including MPESA
.
See How to Authorize Payments and
How to Accept Payments for information.
How to initiate MPESA
payments:
val mpesa = MpesaPaymentRequest(
phone = "+254722000000",
reference = "254722000000",
paybill = true,
destination = "200200"
)
val request = PaymentRequest(
amount = 100,
currency = "kes",
mpesa = mpesa
)
falu.createPayment(request, callback)
// api response callbacks
private val callback = object : ApiResultCallback<Payment> {
override fun onSuccess(result: Payment) {
// display in UI element
}
override fun onError(e: Exception) {
print(e)
}
}
This feature allows you to upload files. See the documentation for more information on how to handle files and uploads
val request = UploadRequest(
file = file,
purpose = "customer.selfie"
)
// making the request
falu.createFile(request, callbacks)
// api response callbacks
private val callbacks = object : ApiResultCallback<FaluFile> {
override fun onSuccess(result: FaluFile) {
// File upload succeeded
}
override fun onError(e: Exception) {
// File upload failed
}
}