SDK Configurations

This guide explains the configuration methods for Dapi Xamarin SDK and how to set environment, send data to your backend server and customize Dapi UI.

Dapi Configurations

You can use DapiConfigurations to configure the SDK as follows.

var configurations = new DapiConfigurations(new string[] { "US", "AE" }, DapiEnvironment.Sandbox);
configurations.ShowTransferSuccessfulResult = true;
configurations.ShowTransferErrorResult = true;
configurations.PostSuccessfulConnectionLoadingText = "Loading..";
configurations.ExtraBody =new Dictionary<string, object> {
    { "key1", "value1"},
    { "key2", "value2"}
};

configurations.ExtraHeaderFields = new Dictionary<string, object> {
    { "key1", "value1"},
    { "key2", "value2"}
};

Configuration Parameters

ParameterDescription
environmentThe running environment for Dapi.
Set to DapiEnvironment.PRODUCTION for production release and DapiEnvironment.SANDBOX for testing.
countriesArray of countries that you support, use the Alpha-2 country codes from COUNTRY CODES LIST
extraHeaderFieldsHashMap of header fields to send to any endpoint.
extraBodyHashMap of entries to include in any request under the key UserExtraBody.
The extraBody will look like UserExtraBody:{Key1:"Value1", "Key2": "Value2"} included in the original request body.
postSuccessfulConnectionLoadingTextThe text to show in the loader screen after a successful credentials input on Connect.
showTransferSuccessfulResultBoolean that controls the Result Screen visibility after a successful payment attempt using Dapi UI. Set true to show Result Screen, false otherwise.
showTransferErrorResultBoolean that controls the Result Screen visibility after a failed payment attempt using Dapi UI. Set true to show Result Screen, false otherwise.

Start the SDK with your configurations

DapiClient client = new DapiClient(DependencyService.Get<IDapiPlatformService>());

var configurations = new DapiConfigurations(new string[] { "US", "AE" }, DapiEnvironment.Sandbox);
configurations.ShowTransferSuccessfulResult = true;
configurations.ShowTransferErrorResult = true;
configurations.PostSuccessfulConnectionLoadingText = "Loading..";
configurations.ExtraBody =new Dictionary<string, object> {
    { "key1", "value1"},
    { "key2", "value2"}
};

configurations.ExtraHeaderFields = new Dictionary<string, object> {
    { "key1", "value1"},
    { "key2", "value2"}
};

await client.StartDapi("ce15a3407b6561da87bd847e27b2f530a6a84279d29d686b3daf60ca2f570cae", "JohnDoe", configurations);

📘

Note

ClientUserID is used to distinguish between different users on the same device. The value for ClientUserID needs to be set by you. We recommend setting clientUserID to your actual user ID that you use to distinguish between users. You should update the clientUserID once the user logs out and another user logs in.

Modify the SDK configurations

You can modify the configurations after you've started the SDK successfully by accessing client.Configurations to set your modifications

client.Configurations.Environment = DapiEnvironment.Sandbox;
client.Configurations.PostSuccessfulConnectionLoadingText = "Loading..";
client.Configurations.ExtraBody =new Dictionary<string, object> {
    { "key1", "value1"},
    { "key2", "value2"}
};
client.Configurations.... = ...;