Core Mobile SDKs

Here you'll get to know the core SDKs of Brick provides you, thereby helping you build fantastic fintech products.

What is core SDK?

Core SDK is a powerful tool through which you can customize the UI of SDKs while connecting your Mobile application with Brick.

Demo Project

We have created a sample demo to understand SDK faster, Please check out the below links for demos.

https://gitlab.com/brick-app/android-demo
https://gitlab.com/brick-app/ios-demo

Sample Application

Still confused? You can install the sample application to understand the flow better.

http://brick-android-demo-staging.s3.amazonaws.com/apk/app-debug.apk
Please share your device UUID at [email protected] You will send customized application for your mobile.

Steps to integrate

We have written a step-by-step guide to help you integrate your app using core SDKs. We have used both Kotlin and Swift languages to showcase the process, These steps allow you to link Financial Institution accounts through Brick's API using our Core SDK.

Before writing code using the SDK, you must first perform some setup steps to register your app with Brick and configure your project. If you haven't yet generated your Sandbox API Keys- Sign Up Now!

Requirements

The Brick Mobile SDK is compatible with apps supporting iOS 10/ Android 8 and above, and can be installed with CocoaPods or Swift Package Manager, Gradle or by manually integrating the framework.

Android

Android 5.0 (API level 21) and above
Android Gradle Plugin 3.5.1
Gradle 5.4.1+
AndroidX (as of v11.0.0)
iOS 9.0
Cococapods 1.10.0

Update your project plugins

As a second step after adding plugin settings, Please update your project plugin by giving the below line of code.

buildscript {
    repositories {
        maven { url 'https://jitpack.io' }
        google()  // Google's Maven repository
        mavenCentral() // Include to import Brick Android SDK
    }
    dependencies {
        // ...
    }
}
pod 'BrickSDK', '~> 1.0'

In your root-level (project-level) Gradle/Podile file (build.gradle), add rules to include the Gradle plugin/Cocoapods

Add Brick Project

As a third step, Please add the below settings in the project configuration

android {
  defaultConfig {
    minSdkVersion 21 // or greater
  }
  // Enable Java 8 support for Brick Android SDK to work
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
}
dependencies {
  // ...
    implementation "io.onebrick.sdk:bricksdk:1.0.53"
}
pod 'BrickSDK', '~> 1.0'

Opening SDK

Please enable the internet, Network state, and phone state to use the Brick core SDK.

import io.onebrick.sdk.*
import io.onebrick.sdk.util.Environment
import io.onebrick.sdk.*
import io.onebrick.sdk.util.Environment
import BrickSDK

Then initialized SDK with trigger eg button etc

private val clientId = "xxx"
   private val clientSecret = "xxx"
   private val name = "xxx"
   private val url = "xxx"
  
  CoreBrickSDK.initializedSDK( applicationContext,
                                 clientId,
                                 clientSecret,
                                 name, url,
                                 Environment.SANDBOX)
private val clientId = "xxx"
   private val clientSecret = "xxx"
   private val name = "xxx"
   private val url = "xxx"
  
  CoreBrickSDK.initializedSDK( applicationContext,
                                 clientId,
                                 clientSecret,
                                 name, url,
                                 Environment.SANDBOX)
CoreBrickSDK.initializedSDK(clientId,
                                 clientSecret,
                                 name, url,
                                 Environment.SANDBOX)

Parameters explanation

Key Parameter

Description

clientId

A client id from Brick

clientSecret

A unique user_id sent to identify the end user at the time of receiving response back from Brick.

**url (Optional)**

Brick returns the newly created user_access_token via POST request to this "redirect_url" parameter. Your server needs to host this redirect_url as a REST API endpoint of type POST.

Environment

Accepted values-
"Environment.SANDBOX" for Sanbox
"Environment.PRODUCTION" for Productio

Available Methods

1. Request Access Token

import com.io.io.sdk.*
import com.io.io.sdk.util.Environment

class MyApp : Application() {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
    override fun onCreate() {
        super.onCreate()
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
    }
    
    val buttonRequest = findViewById<Button>(R.id.button_institution)
        buttonRequest.setOnClickListener {
          CoreBrickSDK.requestAccessToken(object :IAccessTokenRequestResult {
              override fun success(accessToken: AccessToken?) {
                 ...
              }

              override fun error(t: Throwable?) {
                ...
              }

          })
        }
}
import com.io.io.sdk.*
import com.io.io.sdk.util.Environment

class MyApp : Application() {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
    override fun onCreate() {
        super.onCreate()
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
    }
    
    val buttonRequest = findViewById<Button>(R.id.button_institution)
        buttonRequest.setOnClickListener {
          CoreBrickSDK.requestAccessToken(object :IAccessTokenRequestResult {
              override fun success(accessToken: AccessToken?) {
                 ...
              }

              override fun error(t: Throwable?) {
                ...
              }

          })
        }
}
import BrickSDK

class BaseViewController {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
     override func viewDidLoad() {
             super.viewDidLoad()
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
    }
}

Incase of success it will return DataClass AccessToken

Key Parameter

Type

Description

status

String

request status from server

message

String

message from server

data

Data Class AccessTokenData

Data Class AccessTokenData

Data Class AccessTokenData explanation

Key Parameter

Type

Description

access_token

String

String Access token

2. Request Access Token Credentials

import com.io.io.sdk.*
import com.io.io.sdk.util.Environment

class MyApp : Application() {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
    override fun onCreate() {
        super.onCreate()
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
    }
    
    val buttonRequest = findViewById<Button>(R.id.button_institution)
        buttonRequest.setOnClickListener {
            CoreBrickSDK.requestTokenCredentials(object:IRequestTokenCredentials{
               override fun success(response: AccessTokenRequest?) {
                  ...
               }

               override fun error(t: Throwable?) {
                  ...
               }

           })
        }
}
import com.io.io.sdk.*
import com.io.io.sdk.util.Environment

class MyApp : Application() {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
    override fun onCreate() {
        super.onCreate()
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
    }
    
    val buttonRequest = findViewById<Button>(R.id.button_institution)
        buttonRequest.setOnClickListener {
            CoreBrickSDK.requestTokenCredentials(object:IRequestTokenCredentials{
               override fun success(response: AccessTokenRequest?) {
                  ...
               }

               override fun error(t: Throwable?) {
                  ...
               }

           })
        }
}
class BaseViewController {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
     override func viewDidLoad() {
             super.viewDidLoad()
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
            CoreBrickSDK.requestTokenCredentials(object:IRequestTokenCredentials{
               override fun success(response: AccessTokenRequest?) {
                  ...
               }

               override fun error(t: Throwable?) {
                  ...
               }

            })
            }
       
    }

Incase of success it will return DataClass AccessTokenRequest

Key Parameter

Type

Description

status

String

request status from server

message

String

message from server

data

Data Class AccessTokenRequestData

Data Class AccessTokenRequestData

Data Class AccessTokenRequestData explanation

Key Parameter

Type

Description

clientId

Long

Client Id Value

clientName

String

Client Name

clientAlias

String

Client Name Alias

clientImageUrl

String

Client Image Url

clientFullName

String

Client Full Name

clientFavicon

String

Client Favicon

redirectRefId

String

Redirect unique number

3. List Institution

import com.io.io.sdk.*
import com.io.io.sdk.util.Environment

class MyApp : Application() {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
    override fun onCreate() {
        super.onCreate()
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
    }
    
    val buttonRequest = findViewById<Button>(R.id.button_institution)
        buttonRequest.setOnClickListener {
        CoreBrickSDK.listInstitution(object :IRequestInstituion{
               override fun success(response: Institution?) {
                   // will return list of institution
               }

               override fun error(t: Throwable?) {
        
               }

           })
           }
}
import com.io.io.sdk.*
import com.io.io.sdk.util.Environment

class MyApp : Application() {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
    override fun onCreate() {
        super.onCreate()
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
    }
    
    val buttonRequest = findViewById<Button>(R.id.button_institution)
        buttonRequest.setOnClickListener {
        CoreBrickSDK.listInstitution(object :IRequestInstituion{
               override fun success(response: Institution?) {
                   // will return list of institution
               }

               override fun error(t: Throwable?) {
        
               }

           })
           }
}
class BaseViewController {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
     override func viewDidLoad() {
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
    }
    
    val buttonRequest = findViewById<Button>(R.id.button_institution)
        buttonRequest.setOnClickListener {
        CoreBrickSDK.listInstitution(object :IRequestInstituion{
               override fun success(response: Institution?) {
                   // will return list of institution
               }

               override fun error(t: Throwable?) {
        
               }

           })
           }
}

Incase of success it will return DataClass Institution

Key Parameter

Type

Description

status

String

request status from server

message

String

message from server

data

Array Of InstitutionData

Data Class InstitutionData Array

Data Class InstitutionData explanation

Key Parameter

Type

Description

id

Long

Institution

bankName

String

Institution name

bankCode

String

Institution Code

countryName

String

Institution Country Base

type

String

Institution Type

4. Financial Institution Authentication / Employment Data

Basic Function

CoreBrickSDK.authenticateUser(username:String, password: String, institutionId: String, result:IRequestResponseUserAuth)
CoreBrickSDK.authenticateUser(username:String, password: String, institutionId: String, result:IRequestResponseUserAuth)

Parameter Payload

Key Parameter

Type

Description

username

String

Username for Financial Institution

password

String

Password for Financial Institution

institutionId

String

Institution ID from Institution list

Implementation

import com.io.io.sdk.*
import com.io.io.sdk.util.Environment

class MyApp : Application() {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
    override fun onCreate() {
        super.onCreate()
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
    }
    
    val buttonRequest = findViewById<Button>(R.id.button_institution)
        buttonRequest.setOnClickListener {
          CoreBrickSDK.authenticateUser("someUser","somePassword","1",object:IRequestResponseUserAuth{
            override fun success(response: AuthenticateUserResponse) {

             }
             override fun error(t: Throwable?) { 
                   ...
             }

           })
    }
}
import com.io.io.sdk.*
import com.io.io.sdk.util.Environment

class MyApp : Application() {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
    override fun onCreate() {
        super.onCreate()
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
    }
    
    val buttonRequest = findViewById<Button>(R.id.button_institution)
        buttonRequest.setOnClickListener {
          CoreBrickSDK.authenticateUser("someUser","somePassword","1",object:IRequestResponseUserAuth{
            override fun success(response: AuthenticateUserResponse) {

             }
             override fun error(t: Throwable?) { 
                   ...
             }

           })
    }
}
class BaseViewController {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
     override func viewDidLoad() {
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
    }
    val buttonRequest = findViewById<Button>(R.id.button_institution)
        buttonRequest.setOnClickListener {
          CoreBrickSDK.authenticateUser("someUser","somePassword","1",object:IRequestResponseUserAuth{
            override fun success(response: AuthenticateUserResponse) {

             }
             override fun error(t: Throwable?) { 
                   ...
             }

           })
    }
}

🚧

Attention

The process is completed in case of status 200, Otherwise, incase of status 428 go to the next step to do the MFA process ( 4.1 Step Financial Institution Authentication)

Incase of success it will return DataClass AuthenticateUserResponse

Key Parameter

Type

Description

status

String

request status from server

message

String

Password for Financial Institution

data

Data Class AuthenticateUserResponseData

Data Class

accessToken

String

Access token that will used by client to retrieve transaction detail

sessionId

String

Session string generated from Brick server

4.1 Financial Institution Authentication

Basic Function

CoreBrickSDK.submitCredentialsForMFAAccount(payload:MFABankingPayload, result:IRequestTransactionResult)
CoreBrickSDK.submitCredentialsForMFAAccount(payload:MFABankingPayload, result:IRequestTransactionResult)
CoreBrickSDK.submitCredentialsForMFAAccount(payload:MFABankingPayload, result:IRequestTransactionResult)

Parameter Payload

Key Parameter

Type

Description

token

String

OTP SMS that sent from the institution

duration

Long

institutionId

String

Institution ID from Institution list

redirectRefId

String

Redirect unique number

sessionId

String

Session string generated from Brick server

username

String

Username for Financial Institution

password

String

Password for Financial Institution

Implementation

import com.io.io.sdk.*
import com.io.io.sdk.util.Environment

class MyApp : Application() {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
    override fun onCreate() {
        super.onCreate()
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
    }
    
    val buttonRequest = findViewById<Button>(R.id.button_institution)
        buttonRequest.setOnClickListener {
        
       val payload = MFABankingPayload(
                token = "OTP SMS that sent from the institution",
                duration = " you will get the response from the previous step",
                institutionId = "you will get the response from the previous step",
                redirectRefId = "you will get the response from the previous step",
                sessionId = "you will get the response from the previous step",
                username = "you will get the response from the previous step",
                password = "you will get the response from the previous step"
        )
        
          CoreBrickSDK.submitCredentialsForMFAAccount(payload:MFABankingPayload, result:IRequestTransactionResult) {
            override fun success(credentials: AuthenticateUserResponse?) {
                ....
            }

            override fun error(t: Throwable?) {
               ....
               
           })
    }
}
import com.io.io.sdk.*
import com.io.io.sdk.util.Environment

class MyApp : Application() {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
    override fun onCreate() {
        super.onCreate()
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
    }
    
    val buttonRequest = findViewById<Button>(R.id.button_institution)
        buttonRequest.setOnClickListener {
        
       val payload = MFABankingPayload(
                token = "OTP SMS that sent from the institution",
                duration = " you will get the response from the previous step",
                institutionId = "you will get the response from the previous step",
                redirectRefId = "you will get the response from the previous step",
                sessionId = "you will get the response from the previous step",
                username = "you will get the response from the previous step",
                password = "you will get the response from the previous step"
        )
        
          CoreBrickSDK.submitCredentialsForMFAAccount(payload:MFABankingPayload, result:IRequestTransactionResult) {
            override fun success(credentials: AuthenticateUserResponse?) {
                ....
            }

            override fun error(t: Throwable?) {
               ....
               
           })
    }
}
class BaseViewController {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
     override func viewDidLoad() {
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
    }
    
    val buttonRequest = findViewById<Button>(R.id.button_institution)
        buttonRequest.setOnClickListener {
        
       val payload = MFABankingPayload(
                token = "OTP SMS that sent from the institution",
                duration = " you will get the response from the previous step",
                institutionId = "you will get the response from the previous step",
                redirectRefId = "you will get the response from the previous step",
                sessionId = "you will get the response from the previous step",
                username = "you will get the response from the previous step",
                password = "you will get the response from the previous step"
        )
        
          CoreBrickSDK.submitCredentialsForMFAAccount(payload:MFABankingPayload, result:IRequestTransactionResult) {
            override fun success(credentials: AuthenticateUserResponse?) {
                ....
            }

            override fun error(t: Throwable?) {
               ....
               
           })
    }
}

Incase of success it will return DataClass AuthenticateUserResponse

Key Parameter

Type

Description

status

String

request status from server

message

String

message from server

data

Data Class AuthenticateUserResponseData

Data Class

accessToken

String

Access token that will used by client to retrieve transaction detail

sessionId

String

Session string generated from Brick server

*Data Class AuthenticateUserResponseData explanation**

Key Parameter

Type

Description

accessToken

String

Access token that will used by client to retrieve transaction detail

sessionId

String

Session string generated from Brick server

5. Ewallet

Basic Function

CoreBrickSDK.authenticateEwalletUser(payload:MFABankingPayload, result:IRequestTransactionResult)
CoreBrickSDK.authenticateEwalletUser(payload:MFABankingPayload, result:IRequestTransactionResult)

Parameter Payload

Key Parameter

Type

username

String

Username for Financial Institution

institutionId

String

Institution ID from Institution list

redirectRefId

String

Redirect unique number

import com.io.io.sdk.*
import com.io.io.sdk.util.Environment

class MyApp : Application() {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
    override fun onCreate() {
        super.onCreate()
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
    }
    
    val buttonRequest = findViewById<Button>(R.id.button_institution)
        buttonRequest.setOnClickListener {
        
        val payload = MFABankingPayload(
            username = "you will get the response from the previous step",
            institutionId = "you will get the response from the previous step",
            redirectRefId = "you will get the response from the previous step"

        )
        CoreBrickSDK.authenticateEwalletUser(payload,object:IRequestTransactionResult{
            override fun success(credentials: AuthenticateUserResponse?) {
            
            }
            override fun error(t: Throwable?) {
                dismissLoadingActivity()
                showErrorMessage(true,getString(R.string.phoneNotRegistered))
            }
        })
    }
}
import com.io.io.sdk.*
import com.io.io.sdk.util.Environment

class MyApp : Application() {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
    override fun onCreate() {
        super.onCreate()
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
    }
    
    val buttonRequest = findViewById<Button>(R.id.button_institution)
        buttonRequest.setOnClickListener {
        
        val payload = MFABankingPayload(
            username = "you will get the response from the previous step",
            institutionId = "you will get the response from the previous step",
            redirectRefId = "you will get the response from the previous step"

        )
        CoreBrickSDK.authenticateEwalletUser(payload,object:IRequestTransactionResult{
            override fun success(credentials: AuthenticateUserResponse?) {
            
            }
            override fun error(t: Throwable?) {
                dismissLoadingActivity()
                showErrorMessage(true,getString(R.string.phoneNotRegistered))
            }
        })
    }
}
class BaseViewController {

    private val clientId = "Some-client-key"
    private val clientSecret = "some-client-secret"
    private val name = "BRICK"
    private val url = "https://onebrick.io"
    
     override func viewDidLoad() {
          CoreBrickSDK.initializedSDK(clientId,clientSecret,name,url,Environment.YOUR_ENV)
    }
    
    val buttonRequest = findViewById<Button>(R.id.button_institution)
        buttonRequest.setOnClickListener {
        
        val payload = MFABankingPayload(
            username = "you will get the response from the previous step",
            institutionId = "you will get the response from the previous step",
            redirectRefId = "you will get the response from the previous step"

        )
        CoreBrickSDK.authenticateEwalletUser(payload,object:IRequestTransactionResult{
            override fun success(credentials: AuthenticateUserResponse?) {
            
            }
            override fun error(t: Throwable?) {
                dismissLoadingActivity()
                showErrorMessage(true,getString(R.string.phoneNotRegistered))
            }
        })
    }
}

Incase of success it will return DataClass AuthenticateUserResponse

Key Parameter

Type

Description

status

String

request status from server

message

String

message from server

data

Data Class AuthenticateUserResponseData

Data Class

accessToken

String

Access token that will used by client to retrieve transaction detail

sessionId

String

Session string generated from Brick server

📘

Have trouble integrating SDK?

We are here to help! If you have any trouble integrating our SDKs, You can email us at [email protected].


Did this page help you?