Preloader

Exchange Token

Exchange your client-id and client-secret to get a bearer token that can be used to access VAS Services.

Endpoint: POST {{base_url}}/exchange-token
Parameter Type Details
client-id string The client-id from your merchant dashboard.
client-secret string The client-secret from your merchant dashboard.
                    
                        Request Example (guzzle)
                        

<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', '{{base_url}}/exchange-token', [
'json' => [
  'client-id' => 'xxxxxxxxxxx',
  'client-secret' => 'xxxxxxxxxxx',
 ],
'headers' => [
  'accept' => 'application/json',
  'content-type' => 'application/json',
 ],
]);
echo $response->getBody();
                
                        
**Response: SUCCESS (200 OK)**
{
 "message": "Token exchange successful."
"data":
{
 "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiI1IiwianRpIjoiOGQwY2NjZjMzNzNmM2Y1YTUyNDFmNjJjOGI1ZjU2MDNhNzk2ZTUyOWU1YWM2M2U1NGUxY2MyY2FjZmQ1MWM5ZWYyMzQ0Y2VlNTljOWYxZG*********************RO5FbgjMkdFVEjR7drkut6yUayZaXXmNzBS2skOwJ6hSfFmxxCmdD36HaAbhLpsU2oAxkhxo11EHzIxBfQops",
 "token_type": "Bearer",
 "client_id": "gUczNdU*******wgpazyOJmRP",
}
}
                    
                        
**Response: ERROR (403 FAILED)**
{
 "message": {
 "code": 403,
 "error": [
  "Invalid credentials."
 ]
},
"data": [],
"type": "error"
}