Skip to content

The official client for Falu on Andriod

License

Notifications You must be signed in to change notification settings

faluapp/falu-android

Repository files navigation

Falu Logo

Falu Android

GitHub tag (latest by date) Falu Android Language

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.

Installation

Requirements

Setup

Add falu to your build.gradle dependencies.

implementation "io.falu:falu-android:VERSION_NUMBER"

Getting Started

Setup Guide

Get started with our Setup Guide.

Creating an instance of Falu

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

Features

Once you have finished the setup process, you can proceed to use the features and functionalities offered by the SDK

Payments

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)
    }
}

Upload files

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
    }
}