Skip to main content

Authentication

SasaPay APIs are protected and therefore, you need the API credentials to be able to access our APIs resources.

To obtain the credentials, visit Get Started as a Developer section.

With CLIENT ID and CLIENT SECRET obtained from the sandbox application, You can generate an access token by making a GET request to the following endpoint:

Alt test Endpoint: https://sandbox.sasapay.app/api/v2/waas/auth/token/?grant_type=client_credentials

The following Query parameters are expected:

Request Parameters

FieldTypeDescriptionExample
AuthorizationHeaderBasic Auth over HTTPS, this is a base64 encoded string of an app's client ID and client secretAuthorization
grant_typequeryclient_credentials grant type is supported. Put this under ParamsBasic Q1k2RW5SOGl

Example


import requests
import json
from requests.auth import HTTPBasicAuth
def token():

url = 'https://sandbox.sasapay.app/api/v2/waas/auth/token/?grant_type=client_credentials'
params = {'grant_type': 'client_credentials'}
res = requests.get(url,
auth=HTTPBasicAuth(CLIENT_ID, CLIENT_SECRET), params=params)
response = json.loads(res.text)
access_token = response['access_token']
print(access_token)

Response Parameters

FieldTypeDescriptionExample
statusCodeNumericThis is a numeric status code that indicates the status of the response. 0 means success and any other code means an error occurred or the request failed.Please refer to the response codes table above.0
expires_inNumericToken expiry time in seconds3600
access_tokenJSON Response ItemAccess token to access other APIs"qYrRg0v5UiznR”
token_typeStringThe specific type of token“Bearer”
Response Sample
{
"status": true,
"responseCode": "0",
"detail": "SUCCESS",
"access_token": "OrSqa*******jf6ck8L*****4uQNHNkX",
"expires_in": 3600,
"token_type": "Bearer",
"scope": "merchants C2B/B2B/B2C"
}