Create Bank Connection
Create Bank Connection
Let's now create a connection object. A connection represents a user's connection to a bank. So if they authenticate and login, through Dapi, to 2 banks there will be 2 connections.
Since you don't know yet which bank the user will choose, you will just display the connect page. The user has to then pick the bank and enter their credentials.
client.PresentConnect()
Add listeners to handle a successful or a failed connection attempt.
client.BankConnectionFailed += (string bankID, string error) =>
{
Console.WriteLine($"[App] Failed to connect to {bankID} due to {error}");
};
client.BankConnectionSuccessful += async (string bankID, DapiConnection connection) =>
{
Console.WriteLine($"[App] Connected to {bankID}");
};
client.BankRequested += (string bankName, string iban) =>
{
Console.WriteLine($"[App] {bankName} requested for user IBAN: {iban}");
};
That's it. You can now try to run your app on the emulator and call the PresentConnect
function and see Dapi in action!
Create Sandbox User
You can create users for sandbox environment to test your integration with Dapi instead of connecting your real accounts
Navigate to Dashboard -> Apps -> Your App -> Sandbox -> Create a Sandbox User
Enter the following details and click Submit.
- Sandbox Bank: select a bank from the dropdown list
- Sandbox Username : username of your choice
- Sandbox Password : password of your choice
In order to add accounts to a sandbox user, click the NEW button on the Accounts column and provide the following information:
- Acount Name: user's account name (You can see it on the Account Information dialog when you click an account from the Sandbox Users table.)
- Account Number: user's account number (You can see it on the Account Information dialog)
- IBAN: user's IBAN (You can see it on the Account Information dialog)
- Account Type: choose a value from the dropdown
- Balance: set a starting balance for the account
- Currency: choose the currency for the account from the dropdown
Get Cached Connections
When you authenticate and login through Dapi, a DapiConnection object is created and stored in the local cache containing information about your connection to the bank, so that you don't have to authenticate and login again every time you open the app.
client.GetConnections() returns the list of connections in cache.
DapiConnection[] connections = await client.GetConnections();
Dismiss Connect
Closes the presented Connect UI
Parameters
Method does not receive any parameter.
Example
client.DismissConnect();
GetAccountMetaData
A method for obtaining bank account metadata
Parameters
Method does not receive any parameter.
Example
await connection?.GetAccountMetadata();
Get Parameters
A method for obtaining the connection parameters
Parameters
Method does not receive any parameter.
Example
await connection.GetParameters();
Create Connection
Add a new connection based on connection parameters.
Parameters
Parameters | Description |
---|---|
jsonConnectionParameters | DapiConnection's parameters, can be obtained using connection.getParameters() |
Example
await client.CreateConnection(jsonConnectionParameters);
Updated about 1 year ago