Our ready-made SDK helps you connect and integrate your app or website to the API gateway. Jump into the code, get started with PHP!
<?php
# Load API
require "Topups.php";

# Instantiate API request with valid header parameters i.e Authentication, Accept, Content-Type
$topups = new Topups("a12f4f9a99be83f1e631e379834864e7","application/json","application/json");

# Call API with valid body parameters i.e mobile, amount, note, name, email, country, network, currency
$response = $topups->send_airtime("254722000000","100","AIR0000001","Jane Wanjiku","jane.wanjiku@example.com","KE","Safaricom","KES");

# Process API response
echo $response;

API Reference Send Airtime
<?php
# Load API
require "Topups.php";

# Instantiate API request with valid header parameters i.e Authentication, Accept, Content-Type
$topups = new Topups("a12f4f9a99be83f1e631e379834864e7","application/json","application/json");

# Call API with valid body parameters i.e mobile, amount, note, name, email, country, network, currency, payment_network, payment_mobile, payment_name, payment_email
$response = $topups->buy_airtime("254722000000","100","AIR0000001","Jane Wanjiku","jane.wanjiku@example.com","KE","Safaricom","KES","M-Pesa", "254722002000","Joe Omondi", "joe.omondi@example.com");

# Process API response
echo $response;

API Reference Buy Airtime
<?php
# Load API
require "Topups.php";

# Instantiate API request with valid header parameters i.e Authentication, Accept, Content-Type
$topups = new Topups("a12f4f9a99be83f1e631e379834864e7","application/json","application/json");

# Call API with valid body parameters i.e mobile, agent_number, store_number, amount, note, name, email, agent_name, country, network, currency
$response = $topups->send_agent_float("254722000000","678910","678910","1000","FLT0000001","Jane Wanjiku","jane.wanjiku@example.com","JANE ENTERPRISES","KE","M-Pesa","KES");

# Process API response
echo $response;

API Reference Send Agent Float
<?php
# Load API
require "Topups.php";

# Instantiate API request with valid header parameters i.e Authentication, Accept, Content-Type
$topups = new Topups("a12f4f9a99be83f1e631e379834864e7","application/json","application/json");

# Call API with valid body parameters i.e sender, recipient, message, note, name, email, country, network
$response = $topups->send_sms("DEMO","254722000000","Jane, thank you for repaying your loan.","SMS0000001","Jane Wanjiku","jane.wanjiku@example.com","KE","Safaricom");

# Process API response
echo $response;

API Reference Send SMS
<?php
# Load API
require "Topups.php";

# Instantiate API request with valid header parameters i.e Authentication, Accept, Content-Type
$topups = new Topups("a12f4f9a99be83f1e631e379834864e7","application/json","application/json");

# Call API with valid body parameters i.e channel_type
$response = $topups->get_balance("Airtime");

# Process API response
echo $response;

API Reference Get Balance