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/v1/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/v1/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
statusBooleanThis is a boolean true or false status that indicates the outcome of the response. true means success and false means transaction failed or intermittent error occured.true
detailStringA description of the response status sent by SasaPay API.SUCCESS
access_tokenJSON Response ItemAccess token to access other APIs"qYrRg0v5UiznR”
expires_inNumericToken expiry time in seconds3600
token_typeStringThe specific type of tokenBearer
scopeStringThe service that your account is subscribed tomerchants C2B/B2B/B2C
Response Sample
{
"status": true,
"detail": "SUCCESS",
"access_token": "yKrv1N*******ctjQ8oo",
"expires_in": 3600,
"token_type": "Bearer",
"scope": "merchants C2B/B2B/B2C"
}