Tutorial: Connect Corporate Bank A/C & view Transactions
In this section, you will learn how to connect with a Corporate Bank Accounts and access your first financial data like accounts, balance and transactions.
Brick is currently offering two environments:
- Sandbox, a sandbox environment with test data perfect for test and development phases.
- Production, a live environment used in production with real connections to institutions.
To generate your keys for each environment, have a look to our guide to get your Brick API keys or Sign Up now!.
In the following examples we will use the sandbox environment.
Change the base URL to https://api.onebrick.io for each example to switch to production.
Step 1: Generate a JWT bearer token (Public access token)
Use your Sandbox API keys a ClientID & ClientSecret with the generate public token api to get a JWT((JSON Web Token). This JWT or what we call a public access token can be used to launch the Brick widget and access institution list.
curl -u Client ID:Client Secret https://sandbox.onebrick.io/v1/auth/token
{
"status": 200,
"message": "OK",
"data": {
"access_token": "public-sandbox-b70bcf83-87a1-4f2c-8f2a-16d48021413a"
}
}
Key Parameter | Data Type | Description |
---|---|---|
access_token | string | token that is required to connect Brick API |
Step 2: List all supported institutions ( Optional )
You can use this JWT/public access token to view the list of institutions currently supported by Brick or jump to Step 3 directly to try the Brick Front End Widget and connect a Financial Institution to view its data.
curl https://sandbox.onebrick.io/v1/institution/list
-H 'Content-Type: application/json'
-H 'Authorization: Bearer JWT-public-access-token'
Where, [JWT-public-access-token] is the public access token/JWT generated in the previous step which needs to be passed as the Bearer token in the Authorization header.
The api responds with institutions list currently supported by Brick.
{
"status": 200,
"message": "OK",
"data": [
{
"id": 2,
"name": "BCA",
"bank_code": "014",
"country_code": "ID",
"country_name": Indonesia,
"primary_color": "",
"logo": "",
"createdAt": "2020-03-04T16:00:00.889+00:00",
"updatedAt": "2020-03-04T16:00:00.889+00:00",
"channels": [
{
"id": 2,
"institution_id": 2,
"name": "Internet Banking",
"type": "individual",
"status": "active",
"createdAt": "2020-03-04T16:00:00.889+00:00",
"updatedAt": "2020-03-04T16:00:00.889+00:00",
}
]
},
{
"id": 3,
"name": "Mandiri",
"bank_code": "008",
"country_code": "ID",
"country_name": Indonesia,
"primary_color": "",
"logo": "",
"createdAt": "2020-03-04T16:00:00.889+00:00",
"updatedAt": "2020-03-04T16:00:00.889+00:00",
"channels": [
{
"id": 3,
"institution_id": 3,
"name": "Internet Banking",
"type": "individual",
"status": "active",
"createdAt": "2020-03-04T16:00:00.889+00:00",
"updatedAt": "2020-03-04T16:00:00.889+00:00",
}
]
},
{
"id": 4,
"name": "BNI",
"bank_code": "009",
"country_code": "ID",
"country_name": Indonesia,
"primary_color": "",
"logo": "",
"createdAt": "2020-03-04T16:00:00.889+00:00",
"updatedAt": "2020-03-04T16:00:00.889+00:00",
"channels": [
{
"id": 4,
"institution_id": 4,
"name": "Internet Banking",
"type": "individual",
"status": "active",
"createdAt": "2020-03-04T16:00:00.889+00:00",
"updatedAt": "2020-03-04T16:00:00.889+00:00",
}
]
},
{
"id": 5,
"name": "BRI",
"bank_code": "002",
"country_code": "ID",
"country_name": Indonesia,
"primary_color": "",
"logo": "",
"createdAt": "2020-03-04T16:00:00.889+00:00",
"updatedAt": "2020-03-04T16:00:00.889+00:00",
"channels": [
{
"id": 5,
"institution_id": 5,
"name": "Internet Banking",
"type": "individual",
"status": "active",
"createdAt": "2020-03-04T16:00:00.889+00:00",
"updatedAt": "2020-03-04T16:00:00.889+00:00",
}
]
}
]
}
Key Parameter | Data Type | Description |
---|---|---|
id | integer | identification number of the transaction |
name | string | Institution name |
bank_code | string | institution code |
country_code | string | country code for the institution |
country_name | string | country name of the institution |
primary_color | string | primary color of the institution for UI color |
logo | string | logo of the institution |
createdAt | string | date and time of the institution is up |
updatedAt | string | date and time of the institution is updated |
channels - id | integer | institution identification number |
channels - institution_id | integer | institution identification number |
channels - name | string | institution banking name (e.g. Internet banking or Mobile banking) |
channels - type | string | Institution type (e.g. Individual or Corporate) |
channels - createdAt | string | date and time of the institution is up |
channels - updatedAt | string | date and time of the institution is updated |
Step 3: Launch Brick Widget for Corporate Bank Account
Use the JWT/public-access-token to launch the brick widget in your application and let your users connect their Financial Institution accounts with your application.
To launch the brick UI widget you need to construct the URL in the following format-
https://cdn.onebrick.io/sandbox-widget/v1/?accessToken=public-sandbox-access-token
Notice that the URL above is a newer version ( V1 ) of our Brick Widget that contained a new feature inside comparing to the old version. Currently, we still offer you our old Brick Widget where your end-user can only connect a single account at a time ( https://cdn.onebrick.io/sandbox-widget/?accessToken=public-sandbox-access-token ) until further notice.
Therefore, we encourage you to integrate and experienced our newest feature on Brick Widget as soon as possible where your end-user have the ability to connect multiple accounts/institutions in single flow.
P.S : This feature would be very helpful for you to have as much information from the connected accounts/institutions from your end-users.
1. BCA Corporation
From the above picture, you can choose Corporate Banking (KlikBCA Bisnis) to continue with. Then once you choose KlikBCA Bisnis, you will need to key in your UserID and Password.


If your UserID and Password is eligible, then KlikBCA Bisnis will prompt you for your additional information related to Corporate ID, UserID and KeyBCA Response refer to the following picture.


Finally you will be able to see the user-access-token
There are some optional parameters that can be added to the above URL for customizations which can be seen here.
Read the Brick Widget Section to see in-depth integration steps.
Read our Authentication - Build your own Widget on how to generate user-access-token via API.
Step 4: Retrieve Financial Institution accounts
Retrieve List of all accounts for this user
Using the previously created user-access-token in Step 3, we can now retrieve the information about different Corporate Bank Accounts connected by this user.
curl https://sandbox.onebrick.io/v1/account/list
-H 'Content-Type: application/json'
-H 'Authorization: Bearer user-access-token'
Where [user-access-token] is the access token generated after successful Financial Institution connection through the widget which needs to be passed as the Bearer token in the Authorization header.
The API responds with accounts associated with the user who logged in using the Brick widget.
{
"status": 200,
"message": "OK",
"data": [
{
"accountId": "001800412324242",
"accountHolder": "JOHN DOE",
"accountNumber": "80010023203223",
"balances": {
"available": 32395.66,
"current": 32395.66
}
}
]
}
Response Parameter
Keys Parameter | Data Type | Description |
---|---|---|
accountId | string | Account Identification number from end-user's Financial Institution account |
accountHolder | string | Name of the end-user's Financial Institution account holder |
accountNumber | string | Account number from end-user's Financial Institution account |
balances - available | float | End-user's balance amount that is available to use |
balances - current | float | End-user's balance amount that includes "balances-available" and "on-hold amount" |
Retrieve details of a particular Financial Institution account
Using the accountId retrieved from the previous API- accounts list, you can get in-depth details about the account include any identifying information that's available on the account.
curl https://sandbox.onebrick.io/v1/account/detail?accountId=accountId
-H 'Content-Type: application/json'
-H 'Authorization: Bearer user-access-token'
Where [user-access-token] is the access token generated after successful Financial Institution connection through the widget which needs to be passed as the Bearer token in the Authorization header. And accountId is the identification of the account for which you want the details.
The API responds with details of the account associated with the accountId.
{
"status": 200,
"message": "OK",
"data": [
{
"accountId": "001800412324242",
"accountHolder": "JOHN DOE",
"accountNumber": "80010023203223",
"balances": {
"available": 32395.66,
"current": 32395.66
}
}
]
}
Where [user-access-token] is the access token generated after successful Financial Institution connection through the widget which needs to be passed as the Bearer token in the Authorization header. And accountId is the identification of the account for which you want the details.
Step 5: Retrieve transactions
Using the previously generated user-access-token, we can now retrieve all transactions for this user from all his Financial Institution accounts under the login used with the brick widget.
curl https://sandbox.onebrick.io/v1/transaction/list?from=from&to=to
-H 'Content-Type: application/json'
-H 'Authorization: Bearer user-access-token'
Where [user-access-token] is the access token generated after successful Financial Institution through the widget which needs to be passed as the Bearer token in the Authorization header.
The API responds with rich transaction data of all the accounts associated with the user under his login.
{
"status": 200,
"message": "OK",
"data": [
{
"id": 0,
"institution_id": 12,
"account_id": "800103xxxxxx3001",
"category_id": 0,
"subcategory_id": 0,
"merchant_id": 0,
"merchant_name": "TOKOPEDIA",
"location_country_id": 0,
"location_city_id": 0,
"outlet_outlet_id": 0,
"amount": 5.0,
"date": "2021-04-04",
"description": "TOKOPEDIA Rewards",
"status": "CONFIRMED",
"direction": "in"
},
{
"id": 0,
"institution_id": 12,
"account_id": "800103xxxxxx3001",
"category_id": 0,
"subcategory_id": 0,
"merchant_id": 0,
"merchant_name": "SPBU SHELL",
"location_country_id": 0,
"location_city_id": 0,
"outlet_outlet_id": 0,
"amount": 20000.0,
"date": "2021-04-03",
"description": "SPBU SHELL Pembayaran",
"status": "CONFIRMED",
"direction": "out"
},
]
}
Key Parameter | Data Type | Description |
---|---|---|
id | integer | Identification number of the transaction |
institution_id | integer | Institution identification number of the transaction |
account_id | string | end-user account number that is used to do the transaction |
category_id | integer | category identification number of the transaction |
subcategory_id | integer | subcategory identification number of the transaction |
merchant_id | integer | merchant identification number of the transaction |
merchant_name | string | merchant name of the transaction |
location_country_id | integer | country identification number of the merchant |
location_city_id | integer | city identification number of the merchant |
outlet_outlet_id | integer | outlet identification number of the merchant |
amount | float | amount of the transaction |
date | string | date of the transaction |
description | string | description detail of the transaction |
status | string | status of the transaction (Confirm or Pending) |
direction | string | direction of the transaction (in or out) |
Conclusion
Using this step by step guide you have been able to get a first preview on Brick's API and how to integrate Brick in your website or application
Updated 5 months ago