- Introduction
- Get Started
- Download
- Client Libraries
- Webhook Scripts
- Postman Collections
Our ready-made SDK helps you connect and integrate your app or website to the API gateway. Jump into the code, get started with Ruby!
#!/usr/bin/ruby
# Load API
require "topups"
# Instantiate API request with valid header parameters i.e Authentication, Accept, Content-Type
topups = Topups.new("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
puts response
API Reference Send Airtime
#!/usr/bin/ruby
# Load API
require "topups"
# Instantiate API request with valid header parameters i.e Authentication, Accept, Content-Type
topups = Topups.new("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
puts response
API Reference Buy Airtime
#!/usr/bin/ruby
# Load API
require "topups"
# Instantiate API request with valid header parameters i.e Authentication, Accept, Content-Type
topups = Topups.new("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
puts response
API Reference Send Agent Float
#!/usr/bin/ruby
# Load API
require "topups"
# Instantiate API request with valid header parameters i.e Authentication, Accept, Content-Type
topups = Topups.new("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
puts response
API Reference Send SMS
#!/usr/bin/ruby
# Load API
require "topups"
# Instantiate API request with valid header parameters i.e Authentication, Accept, Content-Type
topups = Topups.new("a12f4f9a99be83f1e631e379834864e7","application/json","application/json")
# Call API with valid body parameters i.e channel_type
response = topups.get_balance("Airtime")
# Process API response
puts response
API Reference Get Balance