Connect Layer - Quickstart

Connect Layer provides a client-side functionality that allows you to authenticate user with their bank and retrieve accessCode required to obtain user's permanent token.

Basic Setup

Connect Layer does not have any standalone files that need to be downloaded or installed, instead you simply need to include a short piece of regular JavaScript in your HTML that will load the Connect into your pages.

The following snippet of code will initialize basic version of the connect layer for the Sandbox environment and load authentication page for the user:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=1080px, initial-scale=1.0">
  <title>DAPI</title>
</head>
<body>
  <script src="https://cdn.dapi.co/connect/v3/connector.js"></script>
  <script>
    var handler = Dapi.create({
      environment: Dapi.environments.sandbox,
      appKey: 'your-app-key',
      countries: ['AE'],
      isExperimental: true,
      onSuccess: (d) => console.log(d),
      onFailure: (e) => console.log(e),
    });
    setTimeout(() => {
      handler.open();
    }, 5000)
  </script>
</body>
</html>

If authentication is completed successfully you will receive following parameters in the response:

Parameter

Type

Description

success

Boolean

Status of the authentication request

accessCode

String

Single use, temporary access code that should be exchanged for user token

connectionID

String

Connection identifier.

Is needed to obtain Access Token.

userSecret

String

Encrypted secret of the user.

Is needed in majority of API requests

userID

String

ID of the user.

Is not needed in further API requests

tokenID

String

Token identifier.

Is not needed in further API requests

Example of successful response:

{
    "accessCode": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBLZXkiOiJiY2JmZjJhOGQ5MDk3MDJlYTY2YmM2ZGFlZWZlZjBlNTFiYWQ0OTFmODAzOWZkZTIzMzU3ZTc0ZDJkMDAwMjYyIiwiZXhwIjoxNjI4NDk5NjM3LCJpYXQiOjE2Mjg0OTkzMzcsImp0aSI6ImQ5YTlkNDE0LWVlODUtNDBkYS05NWMzLWRiZjRjNzI4M2RiZSIsIm90cCI6InpnU1d4dkFLcm5iNG1tS1JPZHRFWGhRTGZ3TjJ5WUpPSUN1U050NWMvTE09IiwidXVpZCI6IkJPTUxBRUFEOmVmZDM5ODlkLWNmYmEtNGFmYy1iZjBkLWY0ODk3ZGJmN2UyYiJ9.gFaPEfDjJvjYkI9nBxlupEy7Qxu860DGHNU7Wk86UHI",
    "connectionID": "05322415-6d28-4271-9764-72576b0c90a1",
    "operationID": "BOMLAEAD:b6bb89e8-347b-4a99-859b-bc01d721b5d9",
    "status": "done",
    "success": true,
    "tokenID": "d9a9d414-ee85-40da-95c3-dbf4c7283dbe",
    "userID": "fKlQCakNOXWRRbOGf0jCCHP/qArJP5VLH523+MbnfN+pDicRTPTT34ItzK7j1kunpte9njoDOhj/1v5723hM4g==",
    "userSecret": "iVzJsDT0Yp0qzCub/pmp9ky4i47/9KjrB5NpUOvhS35SFmdOUcQjA7BFhdNQRVn/eTohF5/3pg7cBaWCEDerneSX6i99P0E61HImq+o0R0cp9u/wnxvY1vuj9AYiPdGUQV9N7aW1rYQBRwgSLzgO1HjKbiRxODAtWIFK32s6zC8yNG1MuQjkRBMsSNmJUmc3HKr91CPWUqBblGEqX1FaO7DdaogHvjJK5EqNvSq9BGWAuZsBHjmnk7VketKDR1wi37nHh7ZftT3/rxdSJPfPMStFQPhYlKYNlR+Hc9xRbBxgjaUvz0Yvywj8SBn+/FhnQLbhOfUajlp8LHT2HJ1anXuL1ILwV6Lk5i/bpEwuUeSwqjifKaCUeHcYv6VHKKN3iq61mtdKJYM/zrz8Z2dQDasKozf5ehBz22yhqEnecZSDg8RS2NLW7nPr76oPo+AlNLnQl8hJIg0p8UGVvdJUeV5gCZ2znhTS3aeFNg9ID7jivjVdIGJAjVwQtKT5KsH9c0gQJyQYGiYpojoox3op/WSFfEcPFo8wzMhsd5Dc3dfpmiW1hojn2DThoj0SHBiym1AiZeEiQHm7GQodP/J7d3jeY5P3m/W/G2EoHLEXZMKOQuM8l8fIFMKGhNvjvH5v1w3nXXp3Zcp3czCktfwREGfQ6DaK/37IJqiZzaTdDv4="
}

You will require accessCode, userSecret and connectionID when calling Exchange Token in order to obtain a permanent accessToken for the user. Or you will require the same values when calling an exchange token function in any of the Server Side Libraries .

userSecret value will be required as a parameter in all of the following Data and Payment API calls.