Step 1: Get token
Get API token
All requests are authenticated using the token you will receive from this request. The same token can be used for all requests until it expires. The only content type supported by this request is "application/x-www-form-urlencoded".
Url: /token
Method: POST
Headers:
Name | Type | Req. | Description |
---|---|---|---|
ApiKey | String (50) | Yes | Your merchant API key [Please contact support for Key - [email protected]] |
Accept | String (50) | Yes | The format the response should be returned in e.g. Accept: application/json Accept: application/xml |
URL parameters: N/A
Data parameters:
Name | Type | Req. | Description |
---|---|---|---|
grant_type | String (50) | Yes | Set as "Password". |
SiteCode | String (50) | Yes | The Ozow site code for the site which the payment is being made to. [Please contact support for SiteCode - [email protected]] |
Response object
Name | Type | Description |
---|---|---|
access_token | String (500) | The token needed for subsequent requests. |
token_type | String (50) | The token type. |
expires_in | int | The lifetime of the token in seconds. |
Request example
const string apiKey = "[YOUR API KEY]";
const string siteCode = "[YOUR SITE CODE]";
const string baseUrl = "https://api.ozow.com/token";
var client = new RestClient(baseUrl);
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("ApiKey", apiKey);
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("grant_type", "password");
request.AddParameter("SiteCode", siteCode);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
<?php
$apiKey = "[YOUR API KEY]";
$siteCode = "[YOUR SITE CODE]";
$baseUrl = "https://api.ozow.com/token";
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', $baseUrl, [
'headers' => [
'ApiKey' => $apiKey,
'Accept' => 'application/json',
'Content-Type' => 'application/x-www-form-urlencoded',
],
'form_params' => [
'grant_type' => 'password',
'SiteCode' => $siteCode,
],
]);
echo $response->getBody();
?>
const apiKey = "[YOUR API KEY]";
const siteCode = "[YOUR SITE CODE]";
const baseUrl = "https://api.ozow.com/token";
const options = {
method: "POST",
headers: {
ApiKey: apiKey,
Accept: "application/json",
"Content-Type": "application/x-www-form-urlencoded"
},
body: JSON.stringify({
grant_type: "password",
SiteCode: siteCode
})
};
fetch(baseUrl, options)
.then(response => response.text())
.then(data => console.log(data))
.catch(error => console.error(error));
import requests
api_key = "[YOUR API KEY]"
site_code = "[YOUR SITE CODE]"
base_url = "https://api.ozow.com/token"
headers = {
"ApiKey": api_key,
"Accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded"
}
data = {
"grant_type": "password",
"SiteCode": site_code
}
response = requests.post(base_url, headers=headers, data=data)
print(response.content)
Response example
{
"access_token":"x8EMsgirq_74gw11IY18Ugl...l-FW3vumkyTG0GfXudO9U",
"token_type":"bearer",
"expires_in":86399
}
Updated 9 months ago
What’s Next