Android USSD

Android USSD SDK for implementing the Okra widget

Introduction

This library version allows you to link your account and make payment via the USSD channel

Install

1. Add it in your root build.gradle at the end of repositories:

allprojects {
  repositories {
   ...
   maven { url 'https://jitpack.io' }
   maven {
            url 'https://pro.maven.usehover.com/releases'
            credentials {
                username project.OkraUSSDUsername
                password project.OkraUSSDPassword
            }
            authentication { basic(BasicAuthentication) }
            content { includeGroup "com.hover" }
        }
  }
}

2. Add the dependency:

dependencies {
  implementation 'com.github.okraHQ:okra-android-sdk:v2.61-ussd'
 }

3. Add this to your gradle.properties (Note: The values would be given to you)

OkraUSSDUsername=xxx 
OkraUSSDPassword=xxx

Usage

This SDK allows user to link their account via USSD and to make payment via USSD

Linking via USSD

In other to link your account via USSD all you have to do is add ussd = true in your options eg:

val dataMap: HashMap<String?, Any?> = object : HashMap<String?, Any?>() {
    init {
        put("products",arrayOf("auth", "balance", "identity", "transactions"))
        put("key", "key")
        put("token", "token")
        put("env", "production")
        put("clientName", "Chris")
        put("color", "#953ab7")
        put("limit", "24")
        put("corporate", false)
        put("connectMessage", "Which account do you want to connect with?")
        put("callback_url", "")
        put("redirect_url", "")
        put("short_url", "")
        put("logo", "https://cdn.okra.ng/images/icon.svg")
        put("widget_success", "Your account was successfully linked to Okra, Inc")
        put("widget_failed", "Which account do you want to connect with?")
        put("currency", "NGN")
        put("ussd", true)
        put("success_title", "it has entered success")
        put("success_message", "this is the success message")
    }
}

📘

Want to know more about taking a charge

View our full payments documentation here on other way to enhance the payment experience

Payment

600

If you want to make payment via USSD you need to send ussd = true and add a phone number in the options (This is the phone number that will be notified when the payment is successful), in addition to sending a charge object and payment = true.

final Map<String, Object> charge = new HashMap<>();
charge.put("type", "one-time");
charge.put("amount","10000");
charge.put("note","");
charge.put("currency","NGN");
charge.put("account","account_id");


final Map<String, Object> options = new HashMap<>();
options.put("phone", "+234813328884884");

val dataMap: HashMap<String?, Any?> = object : HashMap<String?, Any?>() {
    init {
        put("products",arrayOf("auth"))
        put("key", "key")
        put("token", "token")
        put("env", "production")
        put("clientName", "Chris")
        put("color", "#953ab7")
        put("limit", "24")
        put("corporate", false)
        put("connectMessage", "Which account do you want to connect with?")
        put("callback_url", "")
        put("redirect_url", "")
        put("logo", "https://cdn.okra.ng/images/icon.svg")
        put("widget_success", "Your account was successfully linked to Okra, Inc")
        put("widget_failed", "Which account do you want to connect with?")
        put("currency", "NGN")
        put("ussd", true)
        put("payment",true)
        put("options", options)
        put("charge",charge)
        put("success_title", "it has entered success")
        put("success_message", "this is the success message")
    }
}

What's Next

View how to integrate the Android SDK or get started with the API.