iOS

Reference for integrating with the Okra Widget iOS SDK

Overview

The Okra Widget SDK is a quick and secure way to link bank accounts to Okra from within your iOS app Link is a drop-in framework that handles connecting a financial institution to your app (credential validation, multi-factor authentication, error handling, etc).

Requirement

  • Check out 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.
  • iOS 10.0+
  • Swift: 5.1
  • Xcode Version: 10.0+

Getting Started

Installations

OkraWidget is available through CocoaPods.
To install it, do this;

  • Add the following line to your Podfile
  pod 'OkraWidget'
  • Run command
  pod install
  • Write Import statement on your source file
  import OkraWidget

The Basis Of Usage for 4.0.5 and below

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

The Basis Of Usage for 4.0.6 and above

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":"",
                                           "short_url": "buildWithShortUrl",
                                           "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")
    }
  
}

🚧

Want to see Okra Options?

View a complete list of customizable options here

Not a developer?

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


Did this page help you?