CreditCheck Print

  • API
  • 0

Obtains the amount of credit available in your account to buy products and services on your Sive.Host account. 

Request Parameters

Parameter Type Description Required
action string “CreditCheck” Required
api_key string API key credentials as per Authentication instructions Required
api_secret string API secret credentials as per Authentication instructions Required

Response Parameters

Parameter Type Description
result string The result of the operation: success or error
credit string The amount of credit available 
currency string The currency of the amount available

Example Request (CURL)

<?php

$apiUrl = 'https://sive.host/includes/sivehost-api.php'; // Change to your API endpoint
$username = 'Ikhaka'; // required
$password = 'Mph#th9mi$'; // required

$postfields = array(
    'api_key' => 'G2dskdXb7BlDwlvbrD1zVEe5ZKQIybXn', // required 
    'api_secret' => 'CtIJVZf8OM1p4iLxwiKFjlU4bPVmEycS', // required
    'action' => 'CreditCheck',    
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); // Basic Authentication
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Use true in production with a valid SSL

$response = curl_exec($ch);

// Check for cURL errors
if (curl_errno($ch)) {
    echo 'cURL Error: ' . curl_error($ch);
}
    
curl_close($ch);

// Output response
echo $response;
?>

Example Response JSON

{
    "result": "success",
    "credit": "867.21",
    "currency": "ZAR"
}

Error Responses

Error Message Cause
unknown client API keys. Incorrect API credentials, request new ones from Sive.Host client area through a support ticket
Invalid API Key or secret. Incorrect API credentials

Version History

Version Changelog
1.0 Initial Version

Was this answer helpful?
Back