Android

Learn how to integrate your app with the Okra Widget Android SDK

Overview

The Okra Widget SDK is a quick and secure way to link bank accounts to Okra in your Android app. Link is a drop-in module that handles connecting a financial institution to your app (credential validation, multi-factor authentication, error handling, etc). All without passing sensitive personal information to your server.

To get started with Okra Widget for Android, clone the GitHub repository and try out the example application, which provides a reference implementation in Java.

Requirements

  • Android Studio 4.0 or above
  • Android 5.0 (API level 21) or above
  • Checkout our get started guide to create your developer account and retrieve your Client Token, API Keys, and Private Keys.
  • Create a sandbox customer, so you can get connecting immediately.

Getting Started

This library would help you add the Okra Widget to you native android app in no time. All you need to do is ...

Install

gradle

  1. Add it in your root build.gradle at the end of repositories:
allprojects {
  repositories {
   ...
   maven { url 'https://jitpack.io' }
  }
}
  1. Add the dependency:
dependencies {
  implementation 'com.github.okraHQ:okra-android-sdk:v3-beta'
 }

Usage versions v2.1-beta and below

ArrayList products = new ArrayList<Enums.Product>();
products.add(Enums.Product.auth);
products.add(Enums.Product.transactions);
OkraOptions okraOptions = new OkraOptions(true, "c81f3e05-7a5c-5727-8d33-1113a3c7a5e4","5d8a35224d8113507c7521ac", products, Enums.Environment.sandbox,"Bassey");
Okra.create(MainActivity.this, okraOptions);

Usage versions v2.2-beta and above

final Map<String, Object> guarantor = new HashMap<>();
        guarantor.put("status", true);
        guarantor.put("message","hello nurse");
        guarantor.put("number",3);

        Map<String, Object> dataMap  = new HashMap<String, Object>() {{
            put("products", new String[]{"auth", "balance", "identity", "transactions"});
            put("key", "public key");
            put("token", "client token");
            put("env", Enums.Environment.production_sandbox.toString());
            put("clientName", "Chris");
            put("color", "#953ab7");
            put("limit", "24");
            put("corporate", false);
            put("connectMessage", "Which account do you want to connect with?");
            put("guarantors", guarantor);
            put("callback_url", "");
            put("short_url: "");
            put("redirect_url", "");
            put("logo", "https://cdn.okra.ng/images/icon.svg");
            //put("filter", new Filter(Enums.IndustryType.all.toString(), banks));
            put("widget_success", "Your account was successfully linked to Okra, Inc");
            put("widget_failed", "Which account do you want to connect with?");
            put("currency", "NGN");
            put("exp", "2020-08-06");
            put("manual", false);
            put("success_title", "it has entered success");
            put("success_message", "this is the success message");
        }};

        Okra.create(MainActivity.this, dataMap);

📘

Need more options?

Checkout a list of all the available Widget Properties to add to your widget options below.

View a complete list of customizable options here

Getting the okra onSuccess and onError response

Okra gives provision to access the response data on the mobile device. Okra wraps the response in the OkraHandler object and passes it back to the View which called it.

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == 1) {
            if(resultCode == Activity.RESULT_OK){
                OkraHandler okraHandler = (OkraHandler) data.getSerializableExtra("okraHandler");
                String rr = okraHandler.getData();
                Log.i("okra okraHandler ", okraHandler != null ? okraHandler.getData() : "nothing");

            }
            if (resultCode == Activity.RESULT_CANCELED) {
                //Write your code if there's no result
           }
        }
    }

OkraHandler

Name

Type

Default Value

Description

isDone

boolean

false

It indicates if the okra process has finished.

isSuccessful

boolean

false

It indicates if the okra process was successful.

hasError

boolean

false

It indicates if the okra process has an error.

Data

Json

null

This is the response that okra provides.

Done connecting?

Checkout our API Overview and see how to use the data you've received and other products you can use to create more personalized experiences for your customers!

Not a developer?

Get started without writing a single line of code, Try our App Builder! Click here to get started


What's Next

You can also try our new USSD Beta build to allow your customers to link via USSD as well or view all our Libraries & SDKs or get started with an API Overview

Did this page help you?