Android SDK for implementing the Okra widget - Okra is a safe and secure web drop-in module and this library provides a front-end web (also available in iOS and JavaScript) SDK for account authentication and payment initiation for each bank that Okra supports.
Checkout the widget flow to view how the Okra Widget works. Click "See How it Works"
- 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.
Bonus Points
- Setup Slack Notifications so you can see your API call statuses and re-run calls in real-time!
This library would help you add the Okra Widget to you native android app in no time. All you need to do is ...
- Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the dependency:
dependencies {
implementation 'com.github.okraHQ:okra-android-sdk:v2.57'
}
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);
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("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);
Name | Type | Required | Default Value | Description |
---|---|---|---|---|
isWebview |
Boolean |
true | true | |
key |
String |
true | undefined | Your public key from Okra. |
token |
String |
true | undefined | Your client token from okra. |
ussd |
Boolean |
false | undefined | Allow customer's to connect via USSD (https://docs.okra.ng/docs/ussd-beta) |
products |
ArrayList<Enums.Product> |
true | undefined | The Okra products you want to use with the widget. |
payment |
Booelan |
false | Whether you want to initiate a payment (https://docs.okra.ng/docs/payments) | |
charge |
Object |
false | Payment charge opject (https://docs.okra.ng/docs/creating-a-charge) | |
env |
Enums.Environment |
true | undefined | |
clientName |
String |
true | undefined | Name of the customer using the widget on the application |
webhook |
String |
true | undefined | The Url that Okra send the client's data to. |
View a complete list of customizable options here
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
}
}
}
Name | Type | Default Value | Description |
---|---|---|---|
isDone |
boolean |
false | flag indicates if the okra process has finished |
isSuccessful |
boolean |
false | flag indicates if the okra process was successful. |
hasError |
boolean |
false | flag indicates if the okra process has an error. |
Data |
Json |
null | this is the response that okra provides. |
Field | Required | Description |
---|---|---|
idObjectID |
Yes | Unique Auth ID (Unique Okra Identifier) |
validatedBoolean |
Yes | Customer authentication status |
bankObjectID |
Yes | Unique Bank ID (Unique Okra Identifier) |
customerObjectID |
Yes | Unique Customer ID (Unique Okra Identifier) |
recordObjectID |
Yes | Unique Record ID (Unique Okra Identifier) |
ownerObjectID |
Yes | Unique Company ID (Unique Okra Identifier) (Your Client Token) |
created_atObject |
Yes | Date Auth was fetched |
last_updatedObject |
Yes | Last Date Auth was fetched |
Field | Required | Description |
---|---|---|
idObjectID |
Yes | Unique Balance ID (Unique Okra Identifier) |
available_balanceInteger |
Yes | Amount of available funds in account |
ledger_balanceInteger |
Yes | Closing balance of account |
currencyString |
Yes | The currency of the account |
connectedBoolean |
Yes | Customer connection status (Did they choose to connect this account to you) |
envString |
Yes | Okra API Env the transaction was pulled from production or production-sandbox |
bankObjectID |
Yes | Unique Bank ID (Unique Okra Identifier) |
accountsObjectID |
Yes | Unique Account ID (Unique Okra Identifier) |
customerObjectID |
Yes | Unique Customer ID (Unique Okra Identifier) |
recordArray of ObjectID |
Yes | Unique Record ID (Unique Okra Identifier) |
created_atObject |
Yes | Date Balance was fetched |
last_updatedObject |
Yes | Last Date Balance was fetched |
Field | Required | Description |
---|---|---|
idObjectID |
Yes | Unique Identifier ID (Unique Okra Identifier) |
firstnameString |
Yes | Customer First Name |
middlenameString |
Yes | Customer Middle Name |
lastnameString |
Yes | Customer Last Name |
next_of_kinsIdentity Object |
Yes | Customer Next of Kins |
dobDate |
Yes | Customer Date of Birth |
verifiedString |
Yes | BVN Validation status |
scoreString |
Yes | Unique Okra Score |
dtiString |
Yes | Customer Debt to Income Score |
fullnameString |
Yes | Customer Fullname |
company_nameString |
**Yes | Company Name if Corporate Identity |
ninString |
Yes | Customer NIN Number |
national_idString |
Yes | Customer National ID Number |
drivers_lisenceString |
Yes | Customer Driver's License Number |
nimcString |
Yes | Customer National Identity Management Commission (NIMC) Number |
voters_idString |
Yes | Customer Voter's ID Number |
rc_numberString |
Yes | Company's Registered Company Number if Corporate Identity |
phoneArray of String |
Yes | Customer Phone Number |
last_loginString |
Yes | Customer Last Login via Okra |
emailArray of String |
Yes | Customer Email address |
addressArray of String |
Yes | Customer |
mothers_maidenString |
Yes | Customer Mother's Maiden Name |
photo_idsArray of Object |
Yes | Customer's photo ID |
envString |
Yes | Okra API Env the transaction was pulled from production or production-sandbox |
bankObjectID |
Yes | Unique Bank ID (Unique Okra Identifier) |
accountsObjectID |
Yes | Unique Account ID (Unique Okra Identifier) |
customerObjectID |
Yes | Unique Customer ID (Unique Okra Identifier) |
recordArray of ObjectID |
Yes | Unique Record ID (Unique Okra Identifier) |
created_atObject |
Yes | Date Balance was fetched |
last_updatedObject |
Yes | Last Date Balance was fetched |
Field | Required | Description |
---|---|---|
idObjectID |
Yes | Unique Transaction ID (Unique Okra Identifier) |
debitInteger |
No | Amount deducted from account |
creditInteger |
No | Amount credited to account |
trans_dateDate |
Yes | Date transaction occurred |
cleared_dateDate |
Yes | Date transaction cleared at bank |
unformatted_trans_dateString |
Yes | Date transaction occurred (from bank) |
unformatted_cleared_dateString |
Yes | Date transaction cleared (from bank) |
branchString |
No | Branch transactions occurred |
refString |
No | Bank reference ID (from bank) |
envString |
Yes | Okra API Env the transaction was pulled from production or production-sandbox |
codeString |
No | Bank Code (from bank) |
benefactorObjectID |
No | Customer ID of sender (within Okra) |
codeString |
No | Bank Code (from bank) |
notesObject |
Yes | Breakdown of Narrative from bank |
bankObjectID |
Yes | Unique Bank ID (Unique Okra Identifier) |
accountObjectID |
Yes | Unique Account ID (Unique Okra Identifier) |
recordArray of ObjectID |
Yes | Unique Record ID (Unique Okra Identifier) |
created_atObject |
Yes | Date transactions was fetched |
last_updatedObject |
Yes | Last Date transactions was fetched |
Field | Required | Description |
---|---|---|
descString |
Yes | Narrative / Description of transaction (combination of bank and user entered information) |
topicsArray of String |
Yes | Topics within the desc |
placesArray of String |
Yes | Places mentioned within the desc |
peopleArray of String |
Yes | People mentioned within the desc |
actionsArray of String |
Yes | Actions mentioned within the desc |
subjectArray of String |
Yes | Subject of the desc |
prepositionArray of String |
Yes | Prepositions within desc to understand intent |
Checkout our API Overiview and see how to use the data you've received and other products you can use to create more personalized experiences for your customers!
Get started without writing a single line of code, Try our App Builder! Click here to get started