iOS 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 Android 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!
To run the example project, clone the repo, and open OkraWidget.xcworkspace
in the Example directory with Xcode, run and build and you are good to go!
- In
Viewcontroller.swift
put the key and token you get from your Okra dashboard
let dataDictionary:[String:Any] = ["isWebview":true,
"key":"key",
"token":"token",
"products": ["auth","transactions"],
"env":Environment.production.rawValue,
"clientName":"Basey",
"source":"ios",
"color":"#953ab7",
"limit":"24",
"guarantors":guarantor,
"corporate":false,
"connectMessage":"Which account do you want to connect with?",
"callback_url":"",
"redirect_url":"",
"logo":"https://cdn.okra.ng/images/icon.svg",
"widget_success":"Your account was successfully linked to Okra, Inc",
"widget_failed":"Which account do you want to connect with?",
"currency":"NGN",
"exp":"2021-08-06",
"manual":false,
"success_title":"Successfully connect bank",
"success_message":"You have successfully connected your bank account"
]
Okra.create(baseController: self, dataDictionary: dataDictionary, okraHandlerDelegate: self)
- iOS 10.0+
- Swift: 5.1
- Xcode Version: 10.0+
OkraWidget is available through CocoaPods. To install
it, simply add the following line to your Podfile and run pod install
:
- Simply add the following line to your
Podfile
pod 'OkraWidget'
- Run command
pod install
- Write Import statement on your source file
import OkraWidget
import OkraWidget
class ViewController: UIViewController,OkraHandlerDelegate {
let launchButton = UIButton(type: .system)
override func viewDidLoad() {
super.viewDidLoad()
setUpConstraintsAndProperties()
}
@objc func showExample(){
let okraOptions = OkraOptions(isWebview: true, key: "key", token: "token", products: ["auth","transactions"], env: Environment.production.rawValue, clientName: "Basey")
Okra.create(baseController: self, okraOptions : okraOptions, okraHandlerDelegate: self)
}
func onSuccess(data: [String : Any]) {
print("Succesfully connected bank \(data)")
}
func onError(data: [String : Any]) {
print("Error Receieved \(data)")
}
func onClose() {
print("Closed")
}
}
import OkraWidget
class ViewController: UIViewController,OkraHandlerDelegate {
let launchButton = UIButton(type: .system)
override func viewDidLoad() {
super.viewDidLoad()
setUpConstraintsAndProperties()
}
@objc func showExample(){
let guarantor:[String:Any] = ["status":true,"message":"hello nurse","number":1]
let dataDictionary:[String:Any] = ["isWebview":true,
"key":"key",
"token":"token",
"products": ["auth","transactions"],
"env":Environment.production.rawValue,
"clientName":"Basey",
"source":"ios",
"color":"#953ab7",
"limit":"24",
"guarantors":guarantor,
"corporate":false,
"connectMessage":"Which account do you want to connect with?",
"callback_url":"",
"redirect_url":"",
"logo":"https://cdn.okra.ng/images/icon.svg",
"widget_success":"Your account was successfully linked to Okra, Inc",
"widget_failed":"Which account do you want to connect with?",
"currency":"NGN",
"exp":"2021-08-06",
"manual":false,
"success_title":"Successfully connect bank",
"success_message":"You have successfully connected your bank account"
]
Okra.create(baseController: self, dataDictionary: dataDictionary, okraHandlerDelegate: self)
}
func onSuccess(data: [String : Any]) {
print("Succesfully connected bank \(data)")
}
func onError(data: [String : Any]) {
print("Error Receieved \(data)")
}
func onClose() {
print("Closed")
}
}
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 key from Okra. |
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) | |
products |
ArrayList<Enums.Product> |
true | undefined | The Okra products you want to use with the widget. |
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
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