Skip to content

faluapp/falu-ios

Repository files navigation

Falu Logo

Falu iOS SDK

GitHub Workflow Status Language GitHub tag (latest by date)

Falu's iOS SDK simplifies the process of building excellent financial services into iOS applications. The SDK exposes APIs that will enable you to make payments and evaluate your client's credit worth.

Installation

Swift Package Manager

Falu is available on SPM. Add the following to you package.

import PackageDescription

let package = Package(
    dependencies: [
        .package(url: "https://github.com/faluapp/falu-ios", from: 1.0.0)
    ]
)

Getting Started

Setup Guide

Follow our Setup Guide to get started.

Create an instance of Falu

let falu =  Falu("PUBLIC_KEY")

The public key is mandatory. Failing to provide it will result into an Error when interacting with Falu.

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.

let mpesa = MpesaPaymentRequest(
    phone: "+254722000000",
    reference: "254722000000",
    paybill: true
)

let request = PaymentRequest(amount: 100, currency: "kes", mpesa: mpesa)

falu.createPayment(request: request) { result in
    if case .failure(let error) = result{
        DispatchQueue.main.async {
            // show errors on the UI thread
        }
    } else {
        DispatchQueue.main.async {
            // show on UI thread
        }
    }
}