Reseller Credit API
Important: You must be a reseller registered under Speedocom Online to use this API.
The Reseller Credit API allows you to transfer SMS credits to your sub-accounts or clients. You can use this in a payment integration to automate account top ups.
Important Notes
- The
apikeyandpartnerIDmust belong to your reseller account. - The
childIDis the client's username. - The
amountis in Kenyan Shillings, converted into SMS units based on configured SMS rate. - If no SMS rate is set, the system defaults to 1.
- Transaction status is returned in the response.
- Credit history is recorded like manual credit loading.
POST Method
Endpoint:https://{{url}}/api/services/credit
Request Body:
{
"apikey": "{{apikey}}",
"partnerID": "{{partnerID}}",
"childID": "{{childID}}",
"amount": "{{amount}}"
}
Sample Success Response:
{
"response-code": 200,
"response-description": "Partner ID xxxx has been credited with 5 units",
"prev-balance": "524.00",
"sms-units": "5",
"new-balance": "529.00"
}
Sample Error Response:
{
"response-code": 1005,
"response-description": "The child account is invalid. Kindly verify the details"
}
Code Examples (POST Request)
$ch = curl_init("https://{{url}}/api/endpoint");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"apikey" => "{{apikey}}",
"partnerID" => "{{partnerID}}",
"childID" => "{{childID}}",
"amount" => "{{amount}}"
]));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
const axios = require('axios');
const data = {
apikey: "{{apikey}}",
partnerID: "{{partnerID}}",
childID: "{{childID}}",
amount: "{{amount}}"
};
axios.post("https://{{url}}/api/endpoint", data, {
headers: { "Content-Type": "application/json" }
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
import requests
url = "https://{{url}}/api/endpoint"
headers = {"Content-Type": "application/json"}
payload = {
"apikey": "{{apikey}}",
"partnerID": "{{partnerID}}",
"childID": "{{childID}}",
"amount": "{{amount}}"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())