Account linking
Bank account linking is a feature that allows clients to link their bank account to a mobile application or a website and pay for goods or services directly through their bank. In some countries, the account linking feature may not be available yet but you can always get in touch with us to double-check.
Initiate user authentication by calling the
/auth
endpoint with the Request-Id
, Redirect-URL
and payments
scope. Service will return an authorizationLink
.You need to specify the
accounts_basic
scope if you want to bypass the account selection step as well. Please keep in mind that account information scopes are not enabled by default.PHP
Node.js
cURL
The example below is written using kevin. PHP library. All other possible attributes and their explanations can be found in the official API documentation.
1
use Kevin\Client;
2
3
$clientId = 'my-client-id';
4
$clientSecret = 'my-client-secret';
5
$options = ['error' => 'array', 'version' => '0.3', 'lang' => 'en'];
6
7
$kevinClient = new Client($clientId, $clientSecret, $options);
8
9
$attr = [
10
'redirectPreferred' => 'false',
11
'scopes' => 'payments',
12
//...or 'scopes' => 'payments,accounts_basic',
13
'Request-Id' => 'your-guid',
14
'Redirect-URL' => 'https://redirect.kevin.eu/authorization.html'
15
];
16
17
$response = $kevinClient->auth()->authenticate($attr);
The example below is written using kevin. Node.js library. All other possible attributes and their explanations can be found in the official API documentation.
1
const kevin = require('@kevin.eu/kevin-platform-client');
2
3
const clientId = 'my-client-id';
4
const clientSecret = 'my-client-secret';
5
6
const client = new kevin.Client(clientId, clientSecret);
7
8
const options = {
9
headers: {
10
'Request-Id': '123',
11
'Redirect-URL': 'https://redirect.kevin.eu/authorization.html'
12
},
13
query: {
14
scopes: ['payments', 'accounts_basic'],
15
},
16
};
17
18
const authenticationData = await client.auth.authenticate(options);
curl --request POST \
--url https://api.kevin.eu/platform/v0.3/auth?redirectPreferred=false&scopes=payments \
--header 'Client-Id: my-client-id' \
--header 'Client-Secret: my-client-secret' \
--header 'Request-Id: your-guid' \
--header 'Redirect-URL: https://redirect.kevin.eu/authorization.html'
From the authentication request above you will receive a
authorizationLink
. The authorization link can lead the user to kevin. frame page or bank environment. The link expires after 48 hours and cannot be reused.{
"authorizationLink": "https://psd2.kevin.eu/login?state=123",
"state": 123
}
After the successful authorization, the client will be redirected back to your
Redirect-URL
with the code
, requestId
and status=success
query parameters. If authorization does not succeed, you will receive a requestId
and a status=failure
.Example:
https://redirect.kevin.eu/authorization.html?requestId=your-guid&code=my-authorization-code&status=success
In order to receive a token, you must exchange your
code
by calling the /auth/token
endpoint. A token can then be used to create payments and skip the login part.PHP
Node.js
cURL
The example below is written using kevin. PHP library. All other possible attributes and their explanations can be found in the official API documentation.
1
use Kevin\Client;
2
3
$clientId = 'my-client-id';
4
$clientSecret = 'my-client-secret';
5
$options = ['error' => 'array', 'version' => '0.3', 'lang' => 'en'];
6
7
$kevinClient = new Client($clientId, $clientSecret, $options);
8
9
$attr = ['code' => 'your-auth-code'];
10
// ...or $attr = 'your-auth-code';
11
12
$response = $kevinClient->auth()->receiveToken($attr);
The example below is written using kevin. Node.js library. All other possible attributes and their explanations can be found in the official API documentation.
1
const kevin = require('@kevin.eu/kevin-platform-client');
2
3
const clientId = 'my-client-id';
4
const clientSecret = 'my-client-secret';
5
6
const client = new kevin.Client(clientId, clientSecret);
7
8
const authKey = 'my-auth-key';
9
10
const tokenData = await client.auth.receiveToken(authKey);
curl --request POST \
--url https://api.kevin.eu/platform/v0.3/auth/token \
--header 'Client-Id: my-client-id' \
--header 'Client-Secret: my-client-secret' \
--header 'Content-Type: application/json' \
--data '{
"grantType": "authorizationCode",
"code": "my-authorization-code"
}'
When token expires, use your refresh token by calling the
/auth/token
endpoint to get a new valid token.PHP
Node.js
cURL
The example below is written using kevin. PHP library. All other possible attributes and their explanations can be found in the official API documentation.
1
use Kevin\Client;
2
3
$clientId = 'my-client-id';
4
$clientSecret = 'my-client-secret';
5
$options = ['error' => 'array', 'version' => '0.3', 'lang' => 'en'];
6
7
$kevinClient = new Client($clientId, $clientSecret, $options);
8
9
$attr = ['refreshToken' => 'your-refresh-token'];
10
// ...or $attr = 'your-refresh-token';
11
12
$response = $kevinClient->auth()->refreshToken($attr);
The example below is written using kevin. Node.js library. All other possible attributes and their explanations can be found in the official API documentation.
1
const kevin = require('@kevin.eu/kevin-platform-client');
2
3
const clientId = 'my-client-id';
4
const clientSecret = 'my-client-secret';
5
6
const client = new kevin.Client(clientId, clientSecret);
7