Backend SDKs

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

Brick provides backend SDKs on top of Brick APIs for faster integration. We have backend SDKs for Javascript(Nodejs) for now.

API References

The Brick API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

You can use the Brick API in test mode, which does not affect your live data or interact with the banking networks. The API key you use to authenticate the request determines whether the request is production mode or sandbox mode.

Installing Library

Get up and running with our client libraries and start developing your Brick integration.The Brick SDK is also available in our Sandbox environment for testing purposes.
You will need to have Sandbox API keys for that. If you haven't yet generated your Sandbox API Keys- Sign Up Now!

///https://www.npmjs.com/package/onebrick-node-sdk
npm install --save onebrick-node-sdk
go get gitlab.com/brick-public-sdk/go-sdk
https://d3qcthppdybi1i.cloudfront.net/brick/brick/brick-sdk.jar

Stepwise Guide

Authentication

The Brick API uses API keys to authenticate requests. You can view and manage your API keys in the Brick Dashboard.

Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

Use your API key by setting it in the initial configuration of Brick. The Serverside library will then automatically send this key in each request.

/***
* please do npm i onebrick-node-sdk 
***/
const {
    BrickSDK,
    ENVIRONMENT
} = require("onebrick-node-sdk");

const clientId = "clientId"
const clientSecret = "ClientSecret"
const name = "Company Name"
const url = "callback URl"

let sdk = new BrickSDK(clientId,
    clientSecret,
    ENVIRONMENT.SANDBOX,
    name,
    url);
let a = await sdk.requestAccessToken();
let b = await sdk.requestAuthentication();
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
  
)

func main() {

	url := "https://sandbox.onebrick.io/v1/auth/token"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Basic clientId:clientSecret")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://sandbox.onebrick.io/v1/auth/token")
  .get()
  .addHeader("Accept", "application/json")
  .build();

Response response = client.newCall(request).execute();
import requests

url = "https://sandbox.onebrick.io/v1/auth/token"

headers = {"Accept": "application/json"}

response = requests.get(url, headers=headers)

print(response.text)

List Institution

This method can help you to get a list of institutions available.

sdk.listInstitution();
url := "https://sandbox.onebrick.io/v1/institution/list"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer public_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://sandbox.onebrick.io/v1/institution/list")
  .get()
  .addHeader("Accept", "application/json")
  .build();

Response response = client.newCall(request).execute();
import requests

url = "https://sandbox.onebrick.io/v1/institution/list"

headers = {"Accept": "application/json"}

response = requests.get(url, headers=headers)

print(response.text)

Response

[
    {
      "id": 2,
      "bankName": "KlikBCA Internet Banking",
      "bankCode": "CENAIDJA",
      "countryName": "ID",
      "type": "Internet Banking",
      "typeId": 1,
      "institutionColor": "#0d3dc8",
      "ocrActive": true
    },
    {
      "id": 3,
      "bankName": "Livin' by Mandiri",
      "bankCode": "BMRIIDJA",
      "countryName": "ID",
      "type": "Internet Banking",
      "typeId": 1,
      "institutionColor": "#2f83d7",
      "ocrActive": true
    },
    {
      "id": 4,
      "bankName": "BNI Internet Banking",
      "bankCode": "BNINIDJA",
      "countryName": "ID",
      "type": "Internet Banking",
      "typeId": 1,
      "institutionColor": "#015f6b",
      "ocrActive": false
    },
    {
      "id": 5,
      "bankName": "BRI Internet Banking",
      "bankCode": "BRINIDJA",
      "countryName": "ID",
      "type": "Internet Banking",
      "typeId": 1,
      "institutionColor": "#012d5a",
      "ocrActive": false
    },
    {
      "id": 8,
      "bankName": "PermataNet",
      "bankCode": "BBBAIDJA",
      "countryName": "ID",
      "type": "Internet Banking",
      "typeId": 1,
      "institutionColor": "#172d51",
      "ocrActive": false
    },
    {
      "id": 9,
      "bankName": "Danamon Online Banking",
      "bankCode": "BDINIDJA",
      "countryName": "ID",
      "type": "Internet Banking",
      "typeId": 1,
      "institutionColor": "#ffa931",
      "ocrActive": false
    },
    {
      "id": 24,
      "bankName": "Mock Bank BCI",
      "bankCode": null,
      "countryName": "ID",
      "type": "Internet Banking",
      "typeId": 1,
      "institutionColor": "#000000",
      "ocrActive": false
    },
    {
      "id": 16,
      "bankName": "BRImo",
      "bankCode": "BRINIDJA",
      "countryName": "ID",
      "type": "Mobile Banking",
      "typeId": 2,
      "institutionColor": "#012d5a",
      "ocrActive": true
    },
    {
      "id": 17,
      "bankName": "Livin' by Mandiri",
      "bankCode": "BMRIIDJA",
      "countryName": "ID",
      "type": "Mobile Banking",
      "typeId": 2,
      "institutionColor": "#2f83d7",
      "ocrActive": true
    },
    {
      "id": 18,
      "bankName": "PermataMobile X",
      "bankCode": "BBBAIDJA",
      "countryName": "ID",
      "type": "Mobile Banking",
      "typeId": 2,
      "institutionColor": "#172d51",
      "ocrActive": false
    },
    {
      "id": 19,
      "bankName": "D-Mobile",
      "bankCode": "BDINIDJA",
      "countryName": "ID",
      "type": "Mobile Banking",
      "typeId": 2,
      "institutionColor": "#ffa931",
      "ocrActive": false
    },
    {
      "id": 13,
      "bankName": "KlikBCA Bisnis",
      "bankCode": "CENAIDJA",
      "countryName": "ID",
      "type": "Corporate Banking",
      "typeId": 3,
      "institutionColor": "#0d3dc8",
      "ocrActive": false
    },
    {
      "id": 11,
      "bankName": "GoPay",
      "bankCode": null,
      "countryName": "ID",
      "type": "E-Wallet",
      "typeId": 4,
      "institutionColor": "#58aed5",
      "ocrActive": false
    },
    {
      "id": 12,
      "bankName": "OVO",
      "bankCode": null,
      "countryName": "ID",
      "type": "E-Wallet",
      "typeId": 4,
      "institutionColor": "#4c2a86",
      "ocrActive": false
    },
    {
      "id": 21,
      "bankName": "Mock E-Wallet",
      "bankCode": null,
      "countryName": "ID",
      "type": "E-Wallet",
      "typeId": 4,
      "institutionColor": "#000000",
      "ocrActive": false
    },
    {
      "id": 14,
      "bankName": "BPJS Ketenagakerjaan",
      "bankCode": "BPJSTK",
      "countryName": "ID",
      "type": "Employment Data",
      "typeId": 5,
      "institutionColor": "#3cab46",
      "ocrActive": false
    },
    {
      "id": 23,
      "bankName": "Mock Employment Data",
      "bankCode": null,
      "countryName": "ID",
      "type": "Employment Data",
      "typeId": 5,
      "institutionColor": "#000000",
      "ocrActive": false
    },
    {
      "id": 15,
      "bankName": "Shopee",
      "bankCode": null,
      "countryName": "ID",
      "type": "E-Commerce",
      "typeId": 6,
      "institutionColor": "#fc5832",
      "ocrActive": false
    },
    {
      "id": 20,
      "bankName": "Tokopedia",
      "bankCode": null,
      "countryName": "ID",
      "type": "E-Commerce",
      "typeId": 6,
      "institutionColor": "#05ac10",
      "ocrActive": false
    },
    {
      "id": 22,
      "bankName": "Mock E-Commerce",
      "bankCode": null,
      "countryName": "ID",
      "type": "E-Commerce",
      "typeId": 6,
      "institutionColor": "#000000",
      "ocrActive": false
    }
  ]

Authenticate with institutions

Once you have a list of institutions, the next step is to authenticate with each institution.

1. Authenticate With BANK / Income Verification

var institutionUsername = 'username'
var institutionPassword = 'password'
var institutionId = 'id from the list of institution with type Internet Banking'
sdk.authenticateWithBank(institutionUsername, institutionPassword, institutionId).then((data) => {
    console.log(data);
}).catch((err) => {
    console.log(err);
 
});
url := "https://sandbox.onebrick.io/v1/auth/clientId=clientId"

	payload := strings.NewReader("{\"institutionId\":0,\"username\":\" \",\"redirectRefId\":\" \",\"password\":\" \"}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer public_access_token")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"access_token\":\"1\",\"userId\":\"1\",\"redirectUrl\":\"1\"}");
Request request = new Request.Builder()
  .url("https://sandbox.onebrick.io/v1/auth/clientId=clientId")
  .post(body)
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "111")
  .addHeader("Content-Type", "application/json")
  .build();

Response response = client.newCall(request).execute();
import requests

url = "https://sandbox.onebrick.io/v1/auth/clientId=clientId"

headers = {
    "Accept": "application/json",
    "Content-Type": "application/json"
}

response = requests.post(url, headers=headers)

print(response.text)

Response

"data": {
    "accessToken": "access-some-access-token",
    "bankId": "institutionId that you choose"
  }

2. Authenticate With Ecommerce

There are two steps on connecting with an e-commerce account because some of eCommerce has MFA(OTP) at the time of login that sent into the user phone number

Step - 1

var institutionUsername = 'username'
var institutionPassword = 'password'
var institutionId = 'id from the list of institution with type Internet Banking'

sdk.authenticateWithEcommerce(username.toString(), password.toString(), parseInt(institutionId.toString())).then((data) => {
	console(data)
}).catch((err) => {
    console.log(err);
});
url := SDK.URL+/"v1/auth"

	req, _ := http.NewRequest("POST", url, nil)

payload := strings.NewReader("{\"institution_id\":\"20\",\"username\":\"23\",\"password\":\"234234\"}")
	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer public_access_token")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"username\":\"1\",\"password\":\"1\"}");
Request request = new Request.Builder()
  .url("https://sandbox.onebrick.io/v1//auth/")
  .post(body)
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "1")
  .addHeader("Content-Type", "application/json")
  .build();

Response response = client.newCall(request).execute();
import requests

url = "https://sandbox.onebrick.io/v1/auth/"

headers = {
    "Accept": "application/json",
    "Content-Type": "application/json"
}

response = requests.post(url, headers=headers)

print(response.text)

Step - 2

var otp = 'input from sms that sent to user'
sdk.reAuthenticationWithEcommerce(otp.toString(), parseInt(institutionId.toString())).then((dataOtp) => {
    console.log(dataOtp)

}).catch((err) => {
    console.log(err);

});
url := SDK.URL+"/v1/auth/shopee/"

	payload := strings.NewReader("{\"institution_id\":\" \",\"password\":\" \",\"sessionId\":\" \",\"username\":\" \",\"token\":\" \",\"requestId\":\" \"}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Basic clientId:clientSecret")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"institution_id\":\"1\",\"username\":\"1\",\"password\":\"1\",\"requestId\":\"1\",\"sessionId\":\"1\",\"token\":\"1\"}");
Request request = new Request.Builder()
  .url("https://sandbox.onebrick.io/v1/auth/shopee/")
  .post(body)
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "1")
  .addHeader("Cookie", "1")
  .addHeader("Content-Type", "application/json")
  .build();

Response response = client.newCall(request).execute();
import requests

url = "https://sandbox.onebrick.io/v1/auth/"

headers = {
    "Accept": "application/json",
    "Content-Type": "application/json"
}

response = requests.post(url, headers=headers)

print(response.text)

Response

"data": {
    "accessToken": "access-some-access-token",
    "bankId": "institutionId that you choose"
  }

3. Authenticate With e-wallet

Connecting with eWallets is also a two steps process and it also varies in the case of e-wallets to e-wallets.

var institutionUsername = 'username'
var institutionId = 'id from the list of institution with type Internet Banking'
sdk.authenticateWithEwallet(institutionUsername, institutionId).then((data) => {
	console.log(data)
})
url := SDK.URL+"/v1/auth/"

	payload := strings.NewReader("{\"institution_id\":\"1\",\"username\":\"2\"}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer public-access-token")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"institution_id\":\"1\",\"username\":\"1\"}");
Request request = new Request.Builder()
  .url("https://sandbox.onebrick.io/v1/auth/")
  .post(body)
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "1")
  .addHeader("Content-Type", "application/json")
  .build();

Response response = client.newCall(request).execute();
import requests

url = "https://sandbox.onebrick.io/v1/auth/shopee/"

payload = {
    "institution_id": "",
    "username": "",
    "password": 1"
}
headers = {
    "Accept": "application/json",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)

Note if the institutiion Id is OVO/ 12 you will receive 2 things, 1 is otp and 2 link verification that sent to user phone

var institutionId = 'id from the list of institution with type Internet Banking'
var otp = 'input from sms that sent to user'
var url = 'url verification that sent into user phone number'

sdk.reauthenticateWithOTPEwallletAndLink(institutionId,otp, url).then((dataOtp) => {
    console.log(dataOtp)
}).catch((err) => {
    console.log(err.response.data);
});
package main

func main() {

	url := SDK.URL+"/v1/auth/"

	payload := strings.NewReader("{\"institution_id\":\"string\",\"username\":\"string\"}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Basic clientId:clientSecret")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"username\":\"1\",\"refId\":\"1\",\"otpNumber\":\"1\",\"pin\":\"1\",\"deviceId\":\"1\"}");
Request request = new Request.Builder()
  .url("https://sandbox.onebrick.io/v1/auth/ovo")
  .post(body)
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "1")
  .addHeader("Content-Type", "application/json")
  .build();

Response response = client.newCall(request).execute();
import requests

url = "https://sandbox.onebrick.io/v1/auth/shopee/"

payload = {
    "institution_id": "",
    "username": "",
    "password": 1"
}
headers = {
    "Accept": "application/json",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)

For other eWallets, You can just use OTP

var institutionId = 'id from the list of institution with type Internet Banking'
var otp = 'input from sms that sent to user'

sdk.reauthenticateWithOTPEwalllet(otp, institutionId).then((dataOtp) => {
    console.log(dataOtp)
}).catch((err) => {
    console.log(err.response.data);
});
func main() {

	url := SDK.URL+"/v1/auth/ovo"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer public_access_token")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"username\":\"1\",\"refId\":\"1\",\"otpNumber\":\"1\",\"pin\":\"1\",\"deviceId\":\"1\"}");
Request request = new Request.Builder()
  .url("https://sandbox.onebrick.io/v1/auth/ovo")
  .post(body)
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "1")
  .addHeader("Content-Type", "application/json")
  .build();

Response response = client.newCall(request).execute();
import requests

url = "https://sandbox.onebrick.io/v1/auth/"

payload = {
    "institution_id": " ",
    "username": " "
}
headers = {
    "Accept": "application/json",
    "Authorization": " ",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)

Account List

The first step after authentication is to get the list of accounts for end-users.

1- Get Account List

This function returns a list of accounts or products held by the end-user with an institution.

sdk.requestAccountGeneral(accessToken).then((data) => {
 	   console.log(data);
 }).catch((err) => {
     console.log(data);
 });
url := SDK.URL+"/v1/account/list"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://sandbox.onebrick.io/v1/account/list"))
    .header("Accept", "application/json")
    .header("Authorization", "1")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
import requests

url = "https://sandbox.onebrick.io/v1/account/list"

headers = {
    "Accept": "application/json",
    "Authorization": " "
}

response = requests.get(url, headers=headers)

print(response.text)

**Response

{
  "status": 200,
  "message": "OK",
  "lastUpdateAt": "2022-01-04 16:42 GMT+0700",
  "session": "valid",
  "data": [
    {
      "accountId": "001800412324242",
      "accountHolder": "JOHN DOE",
      "accountNumber": "80010023203223",
      "balances": {
        "available": 32395.66,
        "current": 32395.66
      }
    }
  ]
}

2- Account List - Post MFA
This function can be used to refresh the session of an institution with MFA by sending a new OTP to the end-user. Currently, E-Wallet can use this customisation.

sdk.requestAccountGeneralMFA(accessToken).then((data) => {
 	    console.log(data);
 }).catch((err) => {
       console.log(data);
 });
url := SDK.URL+"/v1/account/list"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "https://sandbox.onebrick.io/v1/account-mfa/list")
  .setHeader("Accept", "application/json")
  .setHeader("Authorization", "1")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/account-mfa/list"

headers = {
    "Accept": "application/json",
    "Authorization": " "
}

response = requests.post(url, headers=headers)

print(response.text)

Response

{
  "status": 428,
  "message": "An OTP is required by the institution to login",
  "data": {
    "sessionId": "NYnidfEYsMvTeJRSwegtuY9zyZBopT",
    "requestId": "323bfd56-d6cf-4ecc-9c73-43619497cf9d",
    "token": null,
    "duration": "50000"
  }
}

3- Account list - Patch MFA
This function can be used to retrieve the latest list of accounts or products (and their associated data) held by the End User with a Provider by providing a new OTP to refresh the account session. Currently, E-Wallet can use this customization.

sdk .requestAccountGeneralPatch(accessToken,token,sessionId)
      .then((data) => {
        console.log(data);
      })
      .catch((err) => {
        console.log(err);
      });
url := SDK.URL+"/v1/account/list"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "https://sandbox.onebrick.io/v1/account-mfa/list")
  .setHeader("Accept", "application/json")
  .setHeader("Authorization", "1")
  .setHeader("Content-Type", "application/json")
  .setBody("{\"token\":\"1\",\"sessionId\":\"1\"}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/account-mfa/list"

headers = {
    "Accept": "application/json",
    "Authorization": " "
}

response = requests.post(url, headers=headers)

print(response.text)

Response

{
  "status": 200,
  "message": "OK",
  "lastUpdateAt": "2022-01-04 16:42 GMT+0700",
  "session": "valid",
  "data": [
    {
      "accountId": "001800412324242",
      "accountHolder": "JOHN DOE",
      "accountNumber": "80010023203223",
      "balances": {
        "available": 32395.66,
        "current": 32395.66
      }
    }
  ]
}

Account Details

Once you get the user access token using the widget, This function allows developers to retrieve data associated with the specified ‘account_id’ in their backend.

1- Account Details

sdk.requestAccountDetailGeneral(accessToken, institutionId)
  .then((data) => {
  console.log(data);
}) .catch((err) => {
 console.log(err);
});
url := SDK.URL+"/v1/account/detail/accountId=1"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://sandbox.onebrick.io/v1/account/detail/accountId=1")
  .get()
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "1")
  .build();

Response response = client.newCall(request).execute();
import requests

url = "https://sandbox.onebrick.io/v1/account/detail?accountId=accountId"

headers = {
    "Accept": "application/json",
    "Authorization": " "
}

response = requests.get(url, headers=headers)

print(response.text)

Response

{
  "status": 200,
  "message": "OK",
  "lastUpdateAt": "2022-01-04 16:42 GMT+0700",
  "session": "valid",
  "data": {
    "email": "[email protected]",
    "address": ",CIPETE,PINANG /KOTA TANGERANG,CIPETE,INDONESIA,15810",
    "phoneNumber": "08123456789",
    "ktpNumber": null,
    "accountId": "001800412324242",
    "accountHolder": "John Doe",
    "accountNumber": "80010023203223",
    "balances": {
      "available": 142890.37,
      "current": 1428907.3
    }
  }
}

2- Account Details - Post MFA
This function can be used to refresh the session of an institution with MFA by sending a new OTP to the end-user. Currently, E-Wallet can use this customization.

sdk.requestAccountGeneraDetailMFA(accessToken).then((data) => {
        console.log(data);
}).catch((err) => {
  console.log(err);
});
url := SDK.URL+"/v1/account-mfa/detail"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer public_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "https://sandbox.onebrick.io/v1/account-mfa/detail")
  .setHeader("Accept", "application/json")
  .setHeader("Authorization", "1")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/account/detail?accountId=accountId"

headers = {
    "Accept": "application/json",
    "Authorization": " "
}

response = requests.get(url, headers=headers)

print(response.text)

Response

{
  "status": 428,
  "message": "An OTP is required by the institution to login",
  "data": {
    "sessionId": "NYnidfEYsMvTeJRSwegtuY9zyZBopT",
    "requestId": "323bfd56-d6cf-4ecc-9c73-43619497cf9d",
    "token": null,
    "duration": "50000"
  }
}

3- Account Details - Patch MFA
This function can be used to retrieve data associated with the specified ‘account_id’ by providing a new OTP to refresh the account session. Currently, E-Wallet can use this customization.

rl.question("PUT USER ACCESSS TOKEN  :", function (accessToken) {
    rl.question("ACCOUNT ID  :", function (institutionId) {
      sdk
        .requestAccountDetailPatch(accessToken, institutionId,sessionId,AccountId)
        .then((data) => {
          console.log(data);
        })
        .catch((err) => {
          console.log(err);
        });
    });
url := SDK.URL+"/v1/account-mfa/detail"

	req, _ := http.NewRequest("PATCH", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "https://sandbox.onebrick.io/v1/account-mfa/detail")
  .setHeader("Accept", "application/json")
  .setHeader("Content-Type", "application/json")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/account/detail?accountId=accountId"

headers = {
    "Accept": "application/json",
    "Authorization": " "
}

response = requests.get(url, headers=headers)

print(response.text)

Response

{
  "status": 200,
  "message": "OK",
  "lastUpdateAt": "2022-01-04 16:42 GMT+0700",
  "session": "valid",
  "data": {
    "email": "[email protected]",
    "address": ",CIPETE,PINANG /KOTA TANGERANG,CIPETE,INDONESIA,15810",
    "phoneNumber": "08123456789",
    "ktpNumber": null,
    "accountId": "001800412324242",
    "accountHolder": "John Doe",
    "accountNumber": "80010023203223",
    "balances": {
      "available": 142890.37,
      "current": 1428907.3
    }
  }
}

Transaction List

This function allows clients to receive user authorized transactions. Transactions data is standardised across financial institutions and accounts.

1- Transaction List

let startDate = "DATE START  YYYY-MM-DD";
let  endDate = "DATE END YYYY-MM-DD"
sdk.requestTransactionListGeneral(accessToken, startDate, endDate)
    .then((data) => {
        console.log(data);
    })
    .catch((err) => {
        console.log(err);
});
url := SDK.URL+"/v1/transaction/list?from=YYYY-MM-DD&to=YYYY-MM-DD"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "https://sandbox.onebrick.io/v1/transaction/list?from=from&to=to")
  .setHeader("Accept", "application/json")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/transaction/list?from=%20&to=%20"

headers = {
    "Accept": "application/json",
    "Authorization": " "
}

response = requests.get(url, headers=headers)

print(response.text)

Response

{
  "status": 200,
  "message": "OK",
  "lastUpdateAt": "2022-01-04 16:42 GMT+0700",
  "session": "valid",
  "data": [
    {
      "id": 0,
      "account_id": "XH3c7dtoskIqAmEbwHAM7Q==",
      "institution_id": 2,
      "merchant_id": 0,
      "outlet_outlet_id": 0,
      "location_city_id": 0,
      "location_country_id": 0,
      "date": "2021-06-08",
      "amount": 10000,
      "description": "TRSF E-BK CR 06/08 95031 TRF BRICK TO TAUFI C FERNANDO SETIO",
      "status": "CONFIRMED",
      "direction": "in",
      "reference_id": "XH3c7dtoskIqAmEbwHAM7Q==-20210608-1",
      "category": {
        "category_id": 1,
        "category_name": "PURCHASE",
        "classification_group_id": 4,
        "classification_group": "Shopping",
        "classification_subgroup_id": 14,
        "classification_subgroup": "Electronic & Software"
      }
    },
    {
      "id": 0,
      "account_id": "XH3c7dtoskIqAmEbwHAM7Q==",
      "institution_id": 2,
      "merchant_id": 0,
      "outlet_outlet_id": 0,
      "location_city_id": 0,
      "location_country_id": 0,
      "date": "2021-06-21",
      "amount": 222200,
      "description": "KARTU DEBIT THE COFFEE ACADEMI",
      "status": "CONFIRMED",
      "direction": "out",
      "reference_id": "XH3c7dtoskIqAmEbwHAM7Q==-20210621-1",
      "category": {
        "category_id": 1,
        "category_name": "PURCHASE",
        "classification_group_id": 7,
        "classification_group": "Food & Dining",
        "classification_subgroup_id": 26,
        "classification_subgroup": "Coffee & Beverage"
      }
    }
  ]
}

2- Transaction List - Post MFA
This function can be used to refresh the session of an institution with MFA by sending a new OTP to the end-user. Currently, E-Wallet can use this customization.

sdk.requestTransactionListMFA(accessToken)
    .then((data) => {
        console.log(data);
}).catch((err) => {
        console.log(err);
});
url := SDK.URL"/v1/transaction-mfa/list"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer public_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://sandbox.onebrick.io/v1/transaction-mfa/list"))
    .header("Accept", "application/json")
    .method("POST", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
import requests

url = "https://sandbox.onebrick.io/v1/transaction-mfa/list"

headers = {
    "Accept": "application/json",
    "Authorization": " "
}

response = requests.post(url, headers=headers)

print(response.text)

Response

{
  "status": 428,
  "message": "An OTP is required by the institution to login",
  "data": {
    "sessionId": "NYnidfEYsMvTeJRSwegtuY9zyZBopT",
    "requestId": "323bfd56-d6cf-4ecc-9c73-43619497cf9d",
    "token": null,
    "duration": "50000"
  }
}

3- Transaction List - Patch MFA

This function can be used to retrieve all transactions for the account connected by a user by providing a new OTP to refresh the account session. Currently, E-Wallet can use this customization.

rl.question("PUT USER ACCESSS TOKEN  :", function (accessToken) {
    rl.question("DATE START  YYYY-MM-DD:", function (start) {
      rl.question("DATE END YYYY-MM-DD:", function (end) {
        sdk
          .requestTransactionListPatch(accessToken, start, end)
          .then((data) => {
            console.log(data);
          })
          .catch((err) => {
            console.log(err);
          });
      });
    });
url := SDK.URL+"/v1/transaction/list"

	req, _ := http.NewRequest("PATCH", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "https://sandbox.onebrick.io/v1/transaction/list")
  .setHeader("Accept", "application/json")
  .setHeader("Authorization", "1")
  .setHeader("Content-Type", "application/json")
  .setBody("{\"token\":\"TOKEN\",\"sessionId\":\"SESION\",\"from\":\"FROM\",\"to\":\"DATE\"}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/transaction/list"

payload = {
    "token": " ",
    "sessionId": " ",
    "from": " ",
    "to": " "
}
headers = {
    "Accept": "application/json",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)

Response

{
  "status": 200,
  "message": "OK",
  "lastUpdateAt": "2022-01-04 16:42 GMT+0700",
  "session": "valid",
  "data": [
    {
      "id": 0,
      "account_id": "XH3c7dtoskIqAmEbwHAM7Q==",
      "institution_id": 2,
      "merchant_id": 0,
      "outlet_outlet_id": 0,
      "location_city_id": 0,
      "location_country_id": 0,
      "date": "2021-06-08",
      "amount": 10000,
      "description": "TRSF E-BK CR 06/08 95031 TRF BRICK TO TAUFI C FERNANDO SETIO",
      "status": "CONFIRMED",
      "direction": "in",
      "reference_id": "XH3c7dtoskIqAmEbwHAM7Q==-20210608-1",
      "category": {
        "category_id": 1,
        "category_name": "PURCHASE",
        "classification_group_id": 4,
        "classification_group": "Shopping",
        "classification_subgroup_id": 14,
        "classification_subgroup": "Electronic & Software"
      }
    },
    {
      "id": 0,
      "account_id": "XH3c7dtoskIqAmEbwHAM7Q==",
      "institution_id": 2,
      "merchant_id": 0,
      "outlet_outlet_id": 0,
      "location_city_id": 0,
      "location_country_id": 0,
      "date": "2021-06-21",
      "amount": 222200,
      "description": "KARTU DEBIT THE COFFEE ACADEMI",
      "status": "CONFIRMED",
      "direction": "out",
      "reference_id": "XH3c7dtoskIqAmEbwHAM7Q==-20210621-1",
      "category": {
        "category_id": 1,
        "category_name": "PURCHASE",
        "classification_group_id": 7,
        "classification_group": "Food & Dining",
        "classification_subgroup_id": 26,
        "classification_subgroup": "Coffee & Beverage"
      }
    }
  ]
}

Average Balance

This function will allow clients to receive user authorized average balance. It can be generated with a selected period of month&year

sdk.requestInsightWorkerAvgBalance(accessToken, start, end)
    .then((data) => {
        console.log(data);
}).catch((err) => {
        console.log(err);
});
url := SDK.URL+"/v1/avg-balance?from=DATE_START&to=DATE_END"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "https://sandbox.onebrick.io/v1/transaction/list")
  .setHeader("Accept", "application/json")
  .setHeader("Authorization", "1")
  .setHeader("Content-Type", "application/json")
  .setBody("{\"token\":\"TOKEN\",\"sessionId\":\"SESION\",\"from\":\"FROM\",\"to\":\"DATE\"}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/avg-balance?from=%20&to=%20"

headers = {
    "Accept": "application/json",
    "Authorization": " "
}

response = requests.get(url, headers=headers)

print(response.text)

Response

{
  "status": 200,
  "message": "OK",
  "data": [
    {
      "institution_id": 5,
      "accountId": "OrUIr5KQnhJFoHxOMPxUlw==",
      "beginningBalance": 1000,
      "avgBalance": 6935.48,
      "endingBalance": 0,
      "month": "01",
      "year": "2021"
    },
    {
      "institution_id": 5,
      "accountId": "OrUIr5KQnhJFoHxOMPxUlw==",
      "beginningBalance": 0,
      "avgBalance": 41607.14,
      "endingBalance": 35000,
      "month": "02",
      "year": "2021"
    }
  ]
}

Transaction and Balance Summary

This function furnishes the data on monthly basics and helps you get the Beginning balance, Ending balance, Daily balance, Average balance, Income source, and expenses destination.

sdk.requestInsightWorkerBalanceSummary(accessToken, start, end)
          .then((data) => {
            console.log(data);
          })
          .catch((err) => {
            console.log(err);
          });
url := "https://sandbox.onebrick.io/v1/transaction-balance-summary?from=1&to=1"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "https://sandbox.onebrick.io/v1/transaction-balance-summary?from=1&to=1")
  .setHeader("Accept", "application/json")
  .setHeader("user_access_token", "1")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/transaction-balance-summary?from=%20&to=%20"

headers = {
    "Accept": "application/json",
    "user_access_token": " "
}

response = requests.get(url, headers=headers)

print(response.text)

Response

{
“status”: 200,
“message”: “OK”,
“data”: [
    {
        “institution_id”: 2,
        “accountId”: “q4Iudadsa0Aszlu1qB0q2MQ==“,
        “beginningBalance”: 50000.0,
        “avgBalance”: 1520000.0,
        “endingBalance”: 4482873.0,
        “month”: “4”,
        “year”: “2021”,
        “monthly_total_income”: {
            “total_income”: 999999,
            “credit_transaction”: 12
        },
        “monthly_total_expense”: {
            “total_expense”: 33333,
            “debit_transaction”: 23
        },
        “daily_balance”: [
            {
                “date”: “2021-03-31",
                “balance”: 50000.0
            },
            {
                “date”: “2021-04-04”,
                “balance”: 1520000.0
            },
            {
                “date”: “2021-04-05",
                “balance”: 1385128.0
            },
            {
                “date”: “2021-04-06”,
                “balance”: 148128.0
            },
            {
                “date”: “2021-04-07",
                “balance”: 168128.0
            },
            {
                “date”: “2021-04-08”,
                “balance”: 349405.0
            },
            {
                “date”: “2021-04-11",
                “balance”: 270467.0
            },
            {
                “date”: “2021-04-14”,
                “balance”: 63467.0
            },
            {
                “date”: “2021-04-15",
                “balance”: 48467.0
            },
            {
                “date”: “2021-04-18”,
                “balance”: 28467.0
            },
            {
                “date”: “2021-04-20",
                “balance”: 621533.0
            },
            {
                “date”: “2021-04-21”,
                “balance”: 771612.0
            },
            {
                “date”: “2021-04-22",
                “balance”: 4482873.0
            },
            {
                “date”: “2021-04-25”,
                “balance”: 3647073.0
            },
            {
                “date”: “2021-04-26",
                “balance”: 5124073.0
            },
            {
                “date”: “2021-04-27”,
                “balance”: 2012461.0
            }
        ],
        “minimum_daily_balance”: 0.0,
        “maximum_daily_balance”: 99999.0,
        “top_income”: [
            {
                “source”: “Brick”,
                “frequency”: 1,
                “total_amount”: 2.0335035E7
            },
            {
                “source”: “John Doe”,
                “frequency”: 8,
                “total_amount”: 5988000.0
            },
            {
                “source”: “Doe John”,
                “frequency”: 4,
                “total_amount”: 2007000.0
            }
        ],
        “top_expense”: [
            {
                “source”: “Doe John”,
                “frequency”: 5,
                “total_amount”: 2.8855559E7
            },
            {
                “source”: “Brick”,
                “frequency”: 16,
                “total_amount”: 7565000.0
            },
            {
                “source”: “John Doe”,
                “frequency”: 1,
                “total_amount”: 3000000.0
            }

    ]
}
]
}

Categorization API

This function helps you to categorize transactions based on a description.

rl.question("PUT USER ACCESSS TOKEN  :", function (accessToken) {
    rl.question("TRANSACTION DESCRIPTION:", function (transactionDescription) {
        sdk
        .requestCategorization(accessToken, transactionDescription)
        .then((data) => {
          console.log(data);
        })
        .catch((err) => {
          console.log(err);
        });
    });
  });
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := SDK.URL+"/v1/categorization"

	payload := strings.NewReader("{\"transaction_description_text\":\"string\"}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "https://sandbox.onebrick.io/v1/categorization")
  .setHeader("Accept", "application/json")
  .setHeader("public_access_token", "1")
  .setHeader("Content-Type", "application/json")
  .setBody("{\"transaction_description_text\":\"1\"}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/categorization"

payload = {"transaction_description_text": " "}
headers = {
    "Accept": "application/json",
    "public_access_token": " ",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)

Response

{
  "category": {
    "category_id": 1,
    "category_name": "PURCHASE",
    "classification_group_id": 7,
    "classification_group": "Food & Dining",
    "classification_subgroup_id": 26,
    "classification_subgroup": "Coffee & Beverage"
  }
}

PDF Statement

This function will allow downloading the PDF statement retrieved from the financial account based on the 'month' and 'year' parameters. Available only for selected 5 institutions.

rl.question("PUT USER ACCESSS TOKEN  :", function (accessToken) {
    rl.question("MONTH  MM:", function (start) {
      rl.question("YEAR YYYY:", function (end) {
        sdk
          .requestStatement(accessToken, start, end)
          .then((data) => {
            console.log(data);
          })
          .catch((err) => {
            console.log(err);
          });
      });
    });
  });
url := SDK.URL+"/v1/transaction-balance-summary?from=1&to=1"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "https://sandbox.onebrick.io/v1/categorization")
  .setHeader("Accept", "application/json")
  .setHeader("public_access_token", "1")
  .setHeader("Content-Type", "application/json")
  .setBody("{\"transaction_description_text\":\"1\"}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/statement?month=0&year=0"

headers = {
    "Accept": "application/json",
    "Authorization": " "
}

response = requests.get(url, headers=headers)

print(response.text)

Response
The result for this API will be a PDF statement.

Statement Digitization

This function allows developers to upload the passbook and monthly financial statement documents with the format: PDF, PNG, XLS, or JPEG and with a maximum size of 5 MB / file. Response of this function will be the JSON object for fetched data from files.

let accessToken = "";
let userID = "";
let filePath = ""

 sdk.uploadDocumentStatement(accessToken, userID, filePath)
   .then((data) => {
      console.log(data);
    }).catch((err) => {
      console.log(err);
 });
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := SDK.URL+"/v1/documents/extracts"
  parameters: = {userId:'userid',filepath:'urlfilepath'}
	payload := strings.NewReader(paramet)

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer public_access_token")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "https://sandbox.onebrick.io/v1/documents/extracts")
  .setHeader("Accept", "application/json")
  .setHeader("Authorization", "1111")
  .setHeader("Content-Type", "application/json")
  .setBody("{\"user_id\":\"1\"}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/documents/extracts"

payload = {"user_id": " "}
headers = {
    "Accept": "application/json",
    "Authorization": " ",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)

Response

{
  "status": 200,
  "message": "OK",
  "data": {
    "id": "f97be126-5522-4716-b796-2cbc83fb9ee4",
    "fileNames": [
      "BNI - 4.pdf"
    ],
    "user_id": "Test"
  }
}

Employment data

1- Past companies data
This function helps you to get past companies data of your end-users.

sdk.requestEmploymentDataEmployent(accessToken)
      .then((data) => {
        console.log(data);
      })
      .catch((err) => {
        console.log(err);
      });
url := SDK.URL+"/v1/transaction-balance-summary?from=1&to=1"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "https://sandbox.onebrick.io/v1/employment")
  .setHeader("Accept", "application/json")
  .setHeader("public_access_token", "1")
  .setHeader("Content-Type", "application/json")
  .setBody("{\"transaction_description_text\":\"1\"}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/income/employment/"

headers = {
    "Accept": "application/json",
    "user_access_token": " "
}

response = requests.get(url, headers=headers)

print(response.text)

Response

{
    "status": 200,
    "message": "OK",
    "data": [
        {
            "latestSalary": "9500000",
            "companyName": "BRICK TEKNOLOGI INDONESIA",
            "latestPaymentDate": "22-12-2021",
            "workingMonth": "7",
          	"bpjsCardNumber": "15036686069",
            "status": "Aktif"
        },
        {
            "latestSalary": "7660000",
            "companyName": "BERKAH BERSAMA",
            "latestPaymentDate": "09-10-2018",
            "workingMonth": "7",
          	"bpjsCardNumber": "15036686070",
            "status": "Tidak Aktif"
        },
        {
            "latestSalary": "4000000",
            "companyName": "YESBOSS GROUP INDONESIA PT",
            "latestPaymentDate": "15-02-2021",
            "workingMonth": "27",
          	"bpjsCardNumber": "15036686071"
            "status": "Tidak Aktif"
        }
    ]
}

2- Income Information
This function helps you to get past income data of your end-users

sdk
      .requestEmploymentDataGeneral(accessToken)
      .then((data) => {
        console.log(data);
      })
      .catch((err) => {
        console.log(err);
      });
url := SDK.URL+"/v1/transaction-balance-summary?from=1&to=1"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "https://sandbox.onebrick.io/v1/documents/extracts")
  .setHeader("Accept", "application/json")
  .setHeader("Authorization", "1111")
  .setHeader("Content-Type", "application/json")
  .setBody("{\"user_id\":\"1\"}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/income/employment/"

headers = {
    "Accept": "application/json",
    "user_access_token": " "
}

response = requests.get(url, headers=headers)

print(response.text)

Response

[
{   "status": 200,
    "message": "OK",
    "data": [
{
    "companyName": "PT Brick Teknologi Indonesia",
    "monthName": "01-07-2020",
    "salary": “9500000”,
  	"bpjsCardNumber": "15036686069",
},
{
    "companyName": "PT Brick Teknologi Indonesia",
    "monthName": "01-06-2020",
    "salary": “9500000”,
  	"bpjsCardNumber": "15036686070",
},
{
    "companyName": "PT Brick Teknologi Indonesia",
    "monthName": "01-05-2020",
    "salary": “9500000”,
  	"bpjsCardNumber": "15036686071",
}

]

3- General information
This Function helps you to get general employment data of your end-users.

sdk
      .requestEmploymentDataPastCompanies(accessToken)
      .then((data) => {
        console.log(data);
      })
      .catch((err) => {
        console.log(err);
      })
url := "https://sandbox.onebrick.io/v1/transaction-balance-summary?from=1&to=1"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "https://sandbox.onebrick.io/v1/categorization")
  .setHeader("Accept", "application/json")
  .setHeader("public_access_token", "1")
  .setHeader("Content-Type", "application/json")
  .setBody("{\"transaction_description_text\":\"1\"}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/income/employment/"

headers = {
    "Accept": "application/json",
    "user_access_token": " "
}

response = requests.get(url, headers=headers)

print(response.text)

Response

{
  "status": 200,
  "message": "OK",
  "data": [
    {
      "name": "John Doe",
      "ktpNumber": "3277010706920018",
      "dob": "09-10-1989",
      "phoneNumber": "+62812345678",
      "address": "Jl sudirman",
      "gender": "LAKI-LAKI",
      "totalBalance": "25000000",
      "bpjsCards": [
        {
          "number": "15036686069",
          "balance": "12500000"
        },
        {
          "number": "15036686070",
          "balance": "12500000"
        }
      ]
    }
  ]
}

E-Commerce Data

1- E-Commerce Buyers Identity

sdk
      .requestEcommerceBuyerIdentity(accessToken)
      .then((data) => {
        console.log(data);
      })
      .catch((err) => {
        console.log(err);
      });
url := "https://sandbox.onebrick.io/v1/transaction-balance-summary?from=1&to=1"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "https://sandbox.onebrick.io/v1/ecommerce")
  .setHeader("Accept", "application/json")
  .setHeader("public_access_token", "1")
  .setHeader("Content-Type", "application/json")
  .setBody("{\"transaction_description_text\":\"1\"}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/ecommerce/identity"

headers = {
    "Accept": "application/json",
    "Authorization": " "
}

response = requests.get(url, headers=headers)

print(response.text)

Response

{
    “status”: 200,
    “message”: “OK”,
    “data”: {
        “personalProfile”: {
            “username”: “user_name”,
            “name”: “john doe”,
            “email”: “[email protected]”,
            “phoneNumber”: “6281234456789”,
            “storeName”: “John_Doe”,
            “gender”: “Laki-laki”,
            “dateOfBirth”: “2000-01-01T17:00:00.000+00:00”
        },
        “addressList”: [
            {
                “name”: “John Doe”,
                “phoneNumber”: “6281234456789",
                “address”: “kebayoran indah\nKOTA JAKARTA SELATAN-KEBAYORAN INDAH\nDKI JAKARTA\nID 12222",
                "last_1_month_transaction_quantity": 20,
                "last_3_month_transaction_quantity": 50,
                "last_6_month_transaction_quantity": 72
            },
            {
                "name": "Doe",
                "phoneNumber": "62812344567",
                "address": "Vila Weliminium, Gang IV No.2, Jimbaran, KAB. BADUNG-JIMBARAN, BALI, ID 80363",
                "last_1_month_transaction_quantity": 10,
                "last_3_month_transaction_quantity": 20,
                "last_6_month_transaction_quantity": 30
            }
        ]
    }
}

2- Buyer Transaction

let numberOfTransaction = 1;
sdk
      .requestEcommerceBuyerTransaction(accessToken,numberOfTransaction)
      .then((data) => {
        console.log(data);
      })
      .catch((err) => {
        console.log(err);
      });
url := SDK.URL+"/v1/transaction-buyer-transaction?from=1&to=1"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "https://sandbox.onebrick.io/v1/categorization")
  .setHeader("Accept", "application/json")
  .setHeader("public_access_token", "1")
  .setHeader("Content-Type", "application/json")
  .setBody("{\"transaction_description_text\":\"1\"}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/ecommerce/transaction?transaction_quantity=%20"

headers = {
    "Accept": "application/json",
    "Authorization": " "
}

response = requests.get(url, headers=headers)

print(response.text)

Response

{
    “status”: 200,
    “message”: “OK”,
    “data”: {
        “transactionItem”: [
            {
                “transactionId”: “64123141583481”,
                “status”: “order completed”,
                “lastStatusUpdateTime”: “2021-01-13T02:45:04.000+00:00”,
                “itemDetails”: [
                    {
                        “itemName”: “HD / Kaos raglan polos lengan panjang Pria / fashion pria / baju raglan pria / kaos distro”,
                        “pricePerItem”: 19500,
                        “quantity”: 1,
                        “merchantName”: “HD Official Shop”
                    },
                    {
                        “itemName”: “HD / Kaos raglan polos lengan panjang Pria / fashion pria / baju raglan pria / kaos distro”,
                        “pricePerItem”: 19500,
                        “quantity”: 1,
                        “merchantName”: “HD Official Shop”
                    }
                ],
                “totalTransactionAmount”: 2,
                “TotalTransactionPriceAmount”: 39000
            },
            {
                “transactionId”: “64122329146048",
                “status”: “order completed”,
                “lastStatusUpdateTime”: “2021-01-13T07:25:08.000+00:00",
                “itemDetails”: [
                    {
                        “itemName”: “Handuk CID PREMIUM Murah dan Tebal 70x140cm / 420gr”,
                        “pricePerItem”: 37800,
                        “quantity”: 1,
                        “merchantName”: “THREADCOUNT”
                    },
                    {
                        “itemName”: “Handuk CID PREMIUM Murah dan Tebal 70x140cm / 420gr”,
                        “pricePerItem”: 37800,
                        “quantity”: 1,
                        “merchantName”: “THREADCOUNT”
                    }
                ],
                “totalTransactionAmount”: 2,
                “TotalTransactionPriceAmount”: 75600
            }
        ]
    }
}

3- Merchant Identity

sdk
      .requestEcommerceMerchantIdentity(accessToken)
      .then((data) => {
        console.log(data);
      })
      .catch((err) => {
        console.log(err);
      });
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := SDK.URL

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "https://sandbox.onebrick.io/v1/categorization")
  .setHeader("Accept", "application/json")
  .setHeader("public_access_token", "1")
  .setHeader("Content-Type", "application/json")
  .setBody("{\"transaction_description_text\":\"1\"}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/ecommerce/merchant-identity"

headers = {
    "Accept": "application/json",
    "Authorization": " "
}

response = requests.get(url, headers=headers)

print(response.text)

Response

{
    “status”: 200,
    “message”: “OK”,
    “data”: {
        “merchantProfile”: {
            “shopName”: “John_Doe”,
            “joinedDate”: “2020-04-04T04:29:10.000+00:00”,
            “followers”: 0,
            “following”: 2,
            “totalProducts”: 3,
            “responseRate”: 88,
            “responseTime”: “Hitungan jam”,
            “shopRating”: 5.0,
            “totalRatingReceived”: 2
        },
        “addressList”: [
            {
                “name”: “John Doe”,
                “phoneNumber”: “628123456789",
                “address”: “kebayoran indah\nKOTA JAKARTA SELATAN-KEBAYORAN INDAH\nDKI JAKARTA\nID 12222"
                "last_1_month_transaction_quantity": 20,
                "last_3_month_transaction_quantity": 50,
                "last_6_month_transaction_quantity": 72
            },
            {
                "name": "Doe",
                "phoneNumber": "62812344567",
                "address": "Vila Weliminium, Gang IV No.2, Jimbaran, KAB. BADUNG-JIMBARAN, BALI, ID 80363",
                "last_1_month_transaction_quantity": 10,
                "last_3_month_transaction_quantity": 20,
                "last_6_month_transaction_quantity": 30
            }
        ]
    }
}

4- Merchant Income

let accessToken = "";
let startDate = "DATE START  YYYY-MM-DD";
let  endDate = "DATE END YYYY-MM-DD"

sdk
          .requestEcommerceMerchantIncome(accessToken, startDate, endDate)
          .then((data) => {
            console.log(data);
          })
          .catch((err) => {
            console.log(err);
          });
      });
url := SDK.URL

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "https://sandbox.onebrick.io/v1/income")
  .setHeader("Accept", "application/json")
  .setHeader("public_access_token", "1")
  .setHeader("Content-Type", "application/json")
  .setBody("{\"transaction_description_text\":\"1\"}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
import requests

url = "https://sandbox.onebrick.io/v1/ecommerce/income"

headers = {
    "Accept": "application/json",
    "Authorization": " "
}

response = requests.get(url, headers=headers)

print(response.text)

Response

{
    “status”: 200,
    “message”: “OK”,
    “data”: {
        “pendingIncome”: 0.0,
        “totalIncomeThisWeek”: 0.0,
        “totalIncomeThisMonth”: 249000.0,
        “totalIncomeOnTimeRange”: 0.0
    }
}

5- Merchant Transaction

sdk
      .requestEcommerceBuyerTransaction(accessToken,numberOfTransaction)
      .then((data) => {
        console.log(data);
      })
      .catch((err) => {
        console.log(err);
      });
    });
url := "https://sandbox.onebrick.io/v1/transaction-balance-summary?from=1&to=1"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer user_access_token")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://sandbox.onebrick.io/v1/transaction/list?from=1&to=1")
  .get()
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "1")
  .build();

Response response = client.newCall(request).execute();
import requests

url = "https://sandbox.onebrick.io/v1/ecommerce/transaction?transaction_quantity=%20"

headers = {
    "Accept": "application/json",
    "Authorization": " "
}

response = requests.get(url, headers=headers)

print(response.text)

Response

{
    “status”: 200,
    “message”: “OK”,
    “data”: {
        “transactionItem”: [
            {
                “transactionId”: “64123141583481”,
                “status”: “order completed”,
                “lastStatusUpdateTime”: “2021-01-13T02:45:04.000+00:00”,
                “itemDetails”: [
                    {
                        “itemName”: “HD / Kaos raglan polos lengan panjang Pria / fashion pria / baju raglan pria / kaos distro”,
                        “pricePerItem”: 19500,
                        “quantity”: 1,
                        “merchantName”: “HD Official Shop”
                    },
                    {
                        “itemName”: “HD / Kaos raglan polos lengan panjang Pria / fashion pria / baju raglan pria / kaos distro”,
                        “pricePerItem”: 19500,
                        “quantity”: 1,
                        “merchantName”: “HD Official Shop”
                    }
                ],
                “totalTransactionAmount”: 2,
                “TotalTransactionPriceAmount”: 39000
            },
            {
                “transactionId”: “64122329146048",
                “status”: “order completed”,
                “lastStatusUpdateTime”: “2021-01-13T07:25:08.000+00:00",
                “itemDetails”: [
                    {
                        “itemName”: “Handuk CID PREMIUM Murah dan Tebal 70x140cm / 420gr”,
                        “pricePerItem”: 37800,
                        “quantity”: 1,
                        “merchantName”: “HD Official Shop”
                    },
                    {
                        “itemName”: “Handuk CID PREMIUM Murah dan Tebal 70x140cm / 420gr”,
                        “pricePerItem”: 37800,
                        “quantity”: 1,
                        “merchantName”: “HD Official Shop”
                    }
                ],
                “totalTransactionAmount”: 2,
                “TotalTransactionPriceAmount”: 75600
            }
        ]
    }

📘

Have trouble integrating SDK?

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