Skip to content

Create consent

POST
/api/v2/consents
Code sample: Shell / cURL
curl --request POST \
--url https://api.ztlpay.io/api/v2/consents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'PSU-IP-Address: 192.158.1.38' \
--header 'PSU-User-Agent: Mozilla/5.0 (Windows NT 10.0; …) Gecko/20100101 Firefox/63.0' \
--data '{ "userId": "example", "bic": "ESSESESS", "callbackUrl": "https://www.google.com", "organizationNumber": "1234567890", "preferredScaMethod": "Qr", "bankBranch": "example" }'

Create consent and starts authentication process automatically (SCA details is available in response body). For banks having different branches, please refer to the banks api for available branches. Create a consent for the current API before using account information or payment operations.

PSU-IP-Address
required
string
Example
192.158.1.38

AAA IP Address of the end-user initiating the payment. DO NOT use any other IP address than what you can collect from the current user session that uses your system (don’t use something stored in your DB). This information is used by the banks to manage traffic and handle security.

PSU-User-Agent
required
string

The forwarded Agent header field of the HTTP request between PSU and TPP.

Example
Mozilla/5.0 (Windows NT 10.0; …) Gecko/20100101 Firefox/63.0
Media typeapplication/json
object
userId
required

The userId of the account owner providing consent. Different banks use different userId schema, Could be SSN or a userId provided by the bank.

string
bic
required

The bank’s international code/address. Also know as Swift code.

string
Example
ESSESESS
callbackUrl
required

Sca callback url for Redirect authentication

string
Example
https://www.google.com
organizationNumber
required

The organization number

string
Example
1234567890
preferredScaMethod

The preferred way to perform authorization. There is no guarantee that bank supports the preferred method.

  • Qr Used with bank app to scan image.
  • Redirect Redirect link to redirect authorization flow.
string
Allowed values: Qr Redirect
bankBranch

Which branch of the bank if multiple. Can be fetched from supported banks endpoint.

string

Successfully created consent

Media typeapplication/json
object
id
required

An ID that will be used to identify the consent. Used in all AIS and PIS calls.

string format: uuid
status
required
  • AWAITING_AUTHORIZATION Requires user approval
  • VALID Valid consent, can be used for AIS and PIS.
  • REJECTED Consent creation or authentication failed.
  • EXPIRED Consent has expired, a new consent must be created to replace the expired consent.
  • REVOKED Consent was revoked either by user or bank. A new consent must be created to replace the revoked consent.
string
Allowed values: AWAITING_AUTHORIZATION VALID REJECTED EXPIRED REVOKED
sca
One of:
redirect
object
type
required

Redirect link to redirect authorization flow. After the redirect, the url will contain the query parameter status, with the possible values [success, rejected, cancelled]

string
Allowed values: redirect
url
required

Url to start authorization redirect flow

string
Example
{
"id": "B44E9297-934D-4975-8951-7843B16DF63F",
"status": "AWAITING_AUTHORIZATION",
"sca": {
"type": "redirect",
"url": "https://api.ztlpay.io/api/v2/consents/sca/redirect/start/6212d401-1785-4739-8843-55fe4eb9dad4"
}
}
ztl-request-id
string format: uuid

Unique RequestId, please provide this Id in case of support requests

Example
3a797348-ef0c-4f52-b821-fdfcdb98c4d9

Bad Request

Media typeapplication/json
object
failure
  • INVALID_USER_ID Wrong userId
  • INVALID_ORGANIZATION_NUMBER Wrong Organization Number
  • INVALID_BIC Unsupported Bic
  • UNKNOWN_CUSTOMER Customer does not have an account in the bank, or must specify bankBranch
  • AUTHENTICATION_TEMPORARY_UNAVAILABLE Authentication service is temporary unavailable, most likely due to user already has started another concurrent authentication process
string
Allowed values: INVALID_USER_ID INVALID_ORGANIZATION_NUMBER INVALID_BIC UNKNOWN_CUSTOMER AUTHENTICATION_TEMPORARY_UNAVAILABLE
ztlRequestId
required

Unique RequestId, please provide this Id in case of support requests

string format: uuid
message
required

The underlying reason for the error

string
Example
{
"failure": "INVALID_USER_ID",
"ztlRequestId": "3a797348-ef0c-4f52-b821-fdfcdb98c4d9",
"message": "Invalid account"
}
ztl-request-id
string format: uuid

Unique RequestId, please provide this Id in case of support requests

Example
3a797348-ef0c-4f52-b821-fdfcdb98c4d9

Forbidden

Media typeapplication/json
object
ztlRequestId
required

Unique RequestId, please provide this Id in case of support requests

string format: uuid
message
required

The underlying reason for the error

string
Example
{
"ztlRequestId": "3a797348-ef0c-4f52-b821-fdfcdb98c4d9",
"message": "Invalid account"
}
ztl-request-id
string format: uuid

Unique RequestId, please provide this Id in case of support requests

Example
3a797348-ef0c-4f52-b821-fdfcdb98c4d9

Conflict

Media typeapplication/json
object
ztlRequestId
required

Unique RequestId, please provide this Id in case of support requests

string format: uuid
message
required

The underlying reason for the error

string
Example
{
"ztlRequestId": "3a797348-ef0c-4f52-b821-fdfcdb98c4d9",
"message": "Invalid account"
}
ztl-request-id
string format: uuid

Unique RequestId, please provide this Id in case of support requests

Example
3a797348-ef0c-4f52-b821-fdfcdb98c4d9

Internal server error

Media typeapplication/json
object
ztlRequestId
required

Unique RequestId, please provide this Id in case of support requests

string format: uuid
message
required

The underlying reason for the error

string
Example
{
"ztlRequestId": "3a797348-ef0c-4f52-b821-fdfcdb98c4d9",
"message": "Invalid account"
}
ztl-request-id
string format: uuid

Unique RequestId, please provide this Id in case of support requests

Example
3a797348-ef0c-4f52-b821-fdfcdb98c4d9

Service unavailable

Media typeapplication/json
object
ztlRequestId
required

Unique RequestId, please provide this Id in case of support requests

string format: uuid
message
required

The underlying reason for the error

string
Example
{
"ztlRequestId": "3a797348-ef0c-4f52-b821-fdfcdb98c4d9",
"message": "Invalid account"
}
ztl-request-id
string format: uuid

Unique RequestId, please provide this Id in case of support requests

Example
3a797348-ef0c-4f52-b821-fdfcdb98c4d9