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:

NameType Req.Description
ApiKey String (50)YesYour merchant API key [Please contact support for Key - [email protected]]
Accept String (50)YesThe format the response should be returned in e.g.
Accept: application/json
Accept: application/xml

URL parameters: N/A

Data parameters:

NameTypeReq.Description
grant_typeString (50)YesSet as "Password".
SiteCodeString (50)YesThe Ozow site code for the site which the payment is being made to. [Please contact support for SiteCode - [email protected]]

Response object

NameTypeDescription
access_tokenString (500)The token needed for subsequent requests.
token_typeString (50)The token type.
expires_inintThe 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
}