Linked-account payment
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 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 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 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 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 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 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 refreshToken = 'my-refresh-token';
9
10
const tokenData = await client.auth.refreshToken(refreshToken);
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": "refreshToken",
"refreshToken": "my-refresh-code"
}'
Initiate payment by calling the
/pis/payment
endpoint with an Authorization
header. You will receive a confirmLink
. An access token will allow you to 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 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
'Authorization' => 'your-bearer-token'
11
'Redirect-URL' => 'https://redirect.kevin.eu/payment.html',
12
'description' => 'Test',
13
'currencyCode' => 'EUR',
14
'amount' => '0.01',
15
'bankPaymentMethod' => [
16
'endToEndId' => '1',
17
'creditorName' => 'John Smith',
18
'creditorAccount' => [
19
'iban' => 'LT144010051005081586'
20
],
21
],
22
];
23
24
$response = $kevinClient->payment()->initPayment($attr);
The example below is written using kevin. Node.js library. All other possible attributes and their explanations can be found in the 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
'Redirect-URL': 'https://redirect.kevin.eu/payment.html',
11
},
12
query: {
13
redirectPreferred: true
14
},
15
body: {
16
amount: '1.23',
17
currencyCode: 'EUR',
18
description: 'Lorem Ipsum',
19
bankPaymentMethod: {
20
creditorName: 'John Doe',
21
endToEndId: '123',
22
creditorAccount: {
23
iban: 'LT000000000000000000',
24
}
25
}
26
},
27
}
28
29
const payment = await client.payment.initiatePayment(options);
curl --request POST \
--url https://api.kevin.eu/platform/v0.3/pis/payment \
--header 'Client-Id: my-client-id' \
--header 'Client-Secret: my-client-secret' \
--header 'Authorization: Bearer my-bearer-token' \
--header 'Content-Type: application/json' \
--header 'Redirect-URL: https://redirect.kevin.eu/payment.html' \
--data '{
"amount": "0.01",
"currencyCode": "EUR",
"description": "Test",
"bankPaymentMethod": {
"creditorName": "John Doe",
"endToEndId": "1",
"creditorAccount": {
"iban": "LT144010051005081586"
}
}
}'
If you want to skip the account selection part, you need to get the account list by calling the
/ais/accounts
endpoint with an access token and providing one of the bank accounts in the payment initiation request.PHP
Node.js
cURL
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
$accessToken = 'your-bearer-token';
10
$attr = [
11
'Authorization' => $accessToken,
12
'PSU-IP-Address' => 'your-ip-address',
13
'PSU-User-Agent' => 'your-user-agent',
14
'PSU-IP-Port' => 'your-ip-port',
15
'PSU-Http-Method' => 'GET',
16
'PSU-Device-ID' => 'your-device-id',
17
];
18
19
$response = $kevinClient->account()->getAccountList($attr);
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
token: 'my-bearer-token',
10
headers: {
11
'PSU-IP-Address': 'my-ip-address',
12
'PSU-User-Agent': 'my-user-agent',
13
'PSU-IP-Port': 'my-port',
14
'PSU-Http-Method': 'GET',
15
'PSU-Device-ID': 'my-device-id',
16
},
17
};
18
19
const accountList = await client.account.getAccounts(options);
curl --request GET \
--url https://api.kevin.eu/platform/v0.3/ais/accounts \
--header 'Client-Id: my-client-id' \
--header 'Client-Secret: my-client-secret' \
--header 'Authorization: Bearer my-bearer-token' \
--header 'PSU-IP-Address: your-ip-address' \
--header 'PSU-User-Agent: your-user-agent' \
--header 'PSU-IP-Port: your-ip-port' \
--header 'PSU-Http-Method: GET' \
--header 'PSU-Device-ID: your-device-id'
If you want to get an account list, your token must have the
accounts_basic
scope. Account information scopes are not enabled by default. You can check your project settings to see whether you have access.Last modified 3mo ago