Preparation / Prerequisites
This section explains the preparations that are required to get started with Payment Requests API integration.
1. 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.
2. 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.
3. 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
Environment | URL |
---|---|
Production | https://api-auth.clik2pay.com/oauth2/token |
Sandbox | https://api-auth.sandbox.clik2pay.com/oauth2/token |
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"
}
4. Include Key and Access Token when making a request
When creating a request, to for example our Payments Requests API, include your {API Key} and bearer {Access Token} in the header.
- Under headers, enter x-api-key: + {API Key}
- Under headers, enter Authorization: + Bearer {Access Token}
Sample:
--header 'x-api-key: {API Key}' \
--header 'Authorization: Bearer {Access Token}'
Payment Requests API - Resource URLs
Environment | URL |
---|---|
Production | https://api.clik2pay.com/open/v1/ |
Sandbox | https://api.sandbox.clik2pay.com/open/v1/ |
Your bearer access token and API key are unique to each environment. Ie., your sandbox credentials will not work in production, and vice versa.
Updated almost 2 years ago