Bank Accounts Management
Bank Accounts identifiers
In Premium APIs, each banks are defining the required fields to identify a bank account (AccountId, BankId are sample identifiers of a bank account). As soon as you sign a contract with a bank, that bank should provide you a list of bank accounts along with their identifiers.
You can get the expected list of identifiers for the connector by calling
GET /pb/ais/options/{connector id}
which gives you back the options of the connector among which you fond the list of identifiers
{
...
"additionalPropertiesRequested": [
{
"name": "accountId",
"title": "Account Id",
"required": true,
"description": "Id of the account given by the bank",
"template": null
},
{
"name": "bankId",
"title": "Bank Id",
"required": true,
"description": "Account's Bank Id",
"template": null
}
],
...
}
From there you can build a form for manual input or use it to adapt a chunk of code to batch it.
Black boxing
Before using those bank accounts with BankingSDK, you must first get an account context (a black box json string) for each of them. You can achieve that by passing them "manually", one by one or in batch to the Docker which sends you back an account context, a string, which is the black box to use in further calls.
Persisting the account context
This black box follows the same principle as the user context: each time you get an API call answer, you have to check if the account context is not null, if not null, save it and use it in the further calls.
There are two calls to create the initial bank account context. The first one is
POST /pb/ais/access
to initialise the account access request and the second one is
PUT /pb/ais/access
for finalising the account access request.
POST /pb/ais/access
Main body params are
- Connector id
- Bank settings or bank settings code
- User context (created with /pb/users)
- List of accounts with their requested properties
Partial request example for CitiBank which requires the identifiers: accountId and currency.
{
"connectorId": 40004,
"bankSettingsCode": "CITI",
"userContext": "{...}",
...
"accountsAccessRequest": {
"flowId": "987-ABC-789",
"accounts": [
{
"iban": "ZZ123456789987",
"additionalProperties": {
"accountId": "azertyuiop",
"currency": "USD"
}
}
]
}
}
The response object sent back will have an resultStatus of DONE(1) and a flowContext to be sent to the PUT.
PUT /pb/ais/access
Main body params are
- connectorId,
- user context (created with /pb/users) and
- flow context (from POST /pb/ais/access)
Partial response
{
"resultStatus": 1, //done
"userContext": "{...}",
"accounts": [
{
"id": "azertyuiop",
"currency": "USD",
"iban": "ZZ123456789987",
"accountContext": "{...}", // Black box to be saved
"additionalProperties": { // the ones we receive in POST /pb/ais/access
"accountId": "azertyuiop",
"currency": "USD",
}
}
]
}
You can now store for later use the fields Id and accountContext of each bank account.
Let's have another example in Batch transforming
Updated over 2 years ago