Our ready-made SDK helps you connect and integrate your app or website to the API gateway. Jump into the code, get started with Java!
// Load API
import Topups;

public class Example {
    public static void main(String[] args) {
        // Instantiate API request with valid header parameters i.e Authentication, Accept, Content-Type
        Topups topups = new Topups("a12f4f9a99be83f1e631e379834864e7","application/json","application/json");
        
        // Call API with valid body parameters i.e mobile, amount, note, name, email, country, network, currency
        String response = topups.send_airtime("254722000000","100","AIR0000001","Jane Wanjiku","jane.wanjiku@example.com","KE","Safaricom","KES");

        // Process API response
        System.out.println(response);
    }
}

API Reference Send Airtime
// Load API
                            import Topups;
                            
                            public class Example {
                                public static void main(String[] args) {
                                    // Instantiate API request with valid header parameters i.e Authentication, Accept, Content-Type
                                    Topups 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
                                    String 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
                                    System.out.println(response);
                                }
                            }
                            

API Reference Buy Airtime
// Load API
import Topups;

public class Example {
    public static void main(String[] args) {
        // Instantiate API request with valid header parameters i.e Authentication, Accept, Content-Type
        Topups 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
        String 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
        System.out.println(response);
    }
}

API Reference Send Agent Float
// Load API
import Topups;

public class Example {
    public static void main(String[] args) {
        // Instantiate API request with valid header parameters i.e Authentication, Accept, Content-Type
        Topups topups = new Topups("a12f4f9a99be83f1e631e379834864e7","application/json","application/json");
        
        // Call API with valid body parameters i.e sender, recipient, message, note, name, email, country, network
        String 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
        System.out.println(response);
    }
}

API Reference Send SMS
// Load API
import Topups;

public class Example {
    public static void main(String[] args) {
        // Instantiate API request with valid header parameters i.e Authentication, Accept, Content-Type
        Topups topups = new Topups("a12f4f9a99be83f1e631e379834864e7","application/json","application/json");
        
        // Call API with valid body parameters i.e channel_type
        String response = topups.get_balance("Airtime");

        // Process API response
        System.out.println(response);
    }
}

API Reference Get Balance