Changelog

getAccounts

Provides information about all the sub-accounts that the user has in their bank account.

Parameters

Method does not receive any parameter.

Example

await connection.getAccounts();

Response

Response Example


Present Account Selection

Open Dapi's Accounts Screen to allow your user to select an account

await connection.presentAccountSelection();
362

getIdentity

Get the identity information that has been confirmed by the bank.

These are the identity details that you will get. Not all banks provide all this data. So we will provide as much of it as possible.

Parameters
Method does not receive any parameter.

Example

await connection.getIdentity();

Response

Response Example


getCards

A method for obtaining and displaying credit cards of the user

Parameters
Method does not receive any parameter.

Example

await connection.getCards();

Response

Response Example


Account - getTransactions

A method for obtaining and displaying transactions created from users bank accounts. The list will not be filtered. In other words, this will display all the transactions performed by the user from the specified account (not filtered by app).

Parameters

ParameterDescription
accountAccount from where the transaction was performed
fromDateStart date of transactions history range
toDateEnd date of transactions history range
typeEnum to specify transactions type.

DapiTransactionsType.ENRICHED -> Each transaction object will have category and brandDetails properties.

DapiTransactionsType.CATEGORIZED -> Each transaction object will have category property.

DapiTransactionsType.DEFAULT -> category and brandDetails won't be included in the response.

Example

DapiAccountsResponse? accountsResponse = await getAccounts(connection);

await connection.getTransactionsForAccount(accountsResponse!.accounts!.first, fromDate, toDate, type: DapiTransactionsType.DEFAULT);

Response

Response Example


Card - getTransactions()

A method for obtaining and displaying transactions created from a card. The list will not be filtered. In other words, this will display all the transactions performed by the user from the specified account (not filtered by app).

Parameters

ParameterDescription
cardCredit card from where the transaction was performed
fromDateStart date of transactions history range
toDateEnd date of transactions history range
typeEnum to specify transactions type.

DapiTransactionsType.ENRICHED -> Each transaction object will have category and brandDetails properties.

DapiTransactionsType.CATEGORIZED -> Each transaction object will have category property.

DapiTransactionsType.DEFAULT -> category and brandDetails won't be included in the response.

Example

await connection.getTransactionsForCard(connection.cards.first, fromDate, toDate, type: DapiTransactionsType.DEFAULT);

Response

Response Example

πŸ“˜

Note

Date range of the transactions that can be retrieved varies for each bank. The range supported by the users bank is shown in the response parameter transactionRange of Get Accounts Metadata endpoint. If the date range you provide is bigger than the transactionRange you'll get INVALID_DATE_RANGE error.

To make sure you always send a valid date range you should check the transactionsRange.
Example:

Future<DapiTransactionsResponse?> getTransactionsForNumberOfMonths(DapiConnection connection, num numberOfMonths) async {
  num days = numberOfMonths * 30;
  DapiAccountsMetadataResponse accountsMetadataResponse = await connection.getAccountsMetadata();
  DapiValuePair? transactionRange = accountsMetadataResponse.metadata?.transactionRange;
  String? unit = transactionRange?.unit;
  num? value = transactionRange?.value;

  if (unit == null || value == null) {
    //Can't check transactions range..
    return null;
  } else {
    int multiplier = 1;
    if (unit == "years") {
      multiplier = 365;
    } else if (unit == "months") {
      multiplier = 30;
    } else {
      multiplier = 1;
    }

    num transactionRangeValueInDays = value * multiplier;
    DateTime fromDate = DateTime.now();
    if (transactionRangeValueInDays > days) {
      //numberOfMonths is within the transaction range
      fromDate = fromDate.subtract(Duration(days: days.toInt()));
    } else {
      //numberOfMonths is NOT within the transaction range, so we query only for the allowed range
      fromDate = fromDate.subtract(Duration(days: transactionRangeValueInDays.toInt()));
    }
DapiAccountsResponse? accountsResponse = await getAccounts(connection);
DapiTransactionsResponse transactionsResponse = await 
connection.getTransactionsForAccount(accountsResponse!.accounts!.first, fromDate, DateTime.now());
    return transactionsResponse;
  }
}