Zenki
Zenki Home Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Zenkipay Token

Introduction

Zenkipay API is designed on REST, so you will find that the URLs are resource-oriented. In addition HTTP response codes are used to indicate API errors.

It is necessary to have a Zenki account, otherwise it will be necessary to register the merchant at zenki.fi. The Zenki account must be enrolled in the Zenkipay product and have at least one successful test payment.

Security

Successful Zenkipay API requests require the following:

  • HTTP authorization using the Bearer Token scheme.
  • Access credentials for Zenkipay API.

Generate access credentials

To generate access credentials we go to the Zenkipay menu under Settings -> Security, here in the Zenkipay Access Credentials section we click on the “Generate” button.

config

As a result we will get the necessary credentials to make Zenkipay API requests.

Screenshot

API Token

As a first step it is necessary to consume the authentication EndPoint to obtain the Bearer Token and thus be able to consume the Zenkipay API services. At this point is when we will use the Zenkipay API access credentials we obtained earlier.

💡 For the token generation request, the access key is the username and the secret key is the equivalent of the password.

username (Access key): 8dc469a1de4b42759c07c4f2bd6c03f4
password (Secret key): F7E85E907A0DD5FC4B6D6D9E0EE6B0E147BD901ADF66AC24


ENDPOINT

 POST  https://api.zenki.fi/auth/ 
  • Headers

    • Accept: application/json
    • Content-Type: application/x-www-form-urlencoded
  • Body [urlencoded]

    • client_id : zenkipay-api (string)
    • username : 8dc469a1de4b42759c07c4f2bd6c03f4 (string | required)
    • password : F7E85E907A0DD5FC4B6D6D9E0EE6B0E147BD901ADF66AC24 (string | required)
    • grant_type : password (string)
  • Response attributes

    • access_token : (string)
    • expires_in : (number)
    • refresh_expires_in : (string)
    • token_type : (number)
    • not-before-policy : (number)
    • session_state : 1 (number)
    • scope : (string)

cURL

1
2
3
4
5
6
7
8
curl --request POST \
     --url https://api.zenki.fi/auth/ \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/x-www-form-urlencoded' \
     --data client_id=zenkipay-api \
     --data grant_type=password \
     --data username=8dc469a1de4b42759c07c4f2bd6c03f4 \
     --data password=F7E85E907A0DD5FC4B6D6D9E0EE6B0E147BD901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GUiOiJwcm9maWxlIGVtYWlsIiwic2lkIjoiMzU1YWYxODMtODcxOC00NGZhLWFlMDctNWUxYzE5ZDdkOTA1In0.MstH5TJjR99Bu7SkCnXXYasfNGHolUv7UdYBrx6Cujk",
    "token_type": "Bearer",
    "not-before-policy": 1646418979,
    "session_state": "355af183-8718-44fa-ae07-5e1c19d7d905",
    "scope": "profile email"
}

Errors

Code Description json
401 The request has not been executed because it lacks valid authentication credentials for the requested resource. {
“error”: “invalid_request”,
“error_description”: “Missing parameter: username”
}