Preparation / Prerequisites

This section explains the preparations that are required to get started with Payment Requests API integration.

Retrieve your credentials from Clik2pay

You will need a bearer access token and an API key to call our Payment Requests APIs.
Clik2pay will provide you a username and a password (to create the bearer access token - see step 2) and your API key. Make sure you securely store them as you will need them in the next step.

📘

Your bearer access token and API key are unique to each environment. Ie., your sandbox credentials will not work in production, and vice versa.

Create your basic auth credentials

The Payment Requests API is only accessible through OAuth 2.0 Bearer Token authentication.
{Auth Credentials} = Base64 encoding of your username and password.
Use the format: username:password

📘

The authentication call is intended to be a server to server call.

Generate your bearer access token

Call our Auth API to generate your Bearer {Access Token}

  • Under headers, enter Authorization: + Basic {Auth Credentials}
  • In the request body, set the grant_type and scope fields

🚧

Your bearer access token is set to last one hour (3600 seconds)

Auth API - Resource URLs

Sample Request:

curl --location --request POST '{Resource URL}' \
--header 'Authorization: Basic {Auth Credentials}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'scope=payment_request/all'

Sample Response:

{
"access_token": "eyJraWRjOiJra3Q4a29jb3BEUHdraWdPMlwvYVlcL2hzRTliOXhLM …",
"expires_in": 3600,
"token_type": "Bearer"
}

Authenticate to the Payment Requests API

Authenticate to our Payments Requests API by using your {API Key} and bearer {Access Token}.

  • Under headers, enter x-api-key: + {API Key}
  • Under headers, enter Authorization: + Bearer {Access Token}

Sample Request:

curl --location -g --request GET '{Resource URL}' \
--header 'x-api-key: {API Key}' \
--header 'Authorization: Bearer {Access Token}'

Payment Requests API - Resource URLs

📘

Your bearer access token and API key are unique to each environment. Ie., your sandbox credentials will not work in production, and vice versa.