Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.YO-Uganda:YoPaymentsAndroidAPI:1.0.0'
}
dependencies {
implementation("com.github.YO-Uganda:YoPaymentsAndroidAPI:1.0.0")
}
<dependency>
<groupId>com.github.YO-Uganda</groupId>
<artifactId>YoPaymentsAndroidAPI</artifactId>
<version>1.0.0</version>
</dependency>
libraryDependencies += "com.github.YO-Uganda" % "YoPaymentsAndroidAPI" % "1.0.0"
:dependencies [[com.github.YO-Uganda/YoPaymentsAndroidAPI "1.0.0"]]
Yo! Payments is a revolutionary mobile payments gateway service. Yo! Payments enables businesses to receive payments from their customers via mobile money, as well as make mobile money payments to any mobile money account holder. Yo! Payments also has the capability to send mobile calling credit (“airtime”) directly to users.
Yo! Payments API Android Library is an Android library that can be included in your Android project to enable seamless integration with your Android application.
To use the API, you must, first of all, have a Yo! Payments Business Account. The API is not available for Personal Accounts
YoPay yoAPI = new YoPay(YoAPIUsername, YoAPIPassword);
Add it to your build.gradle with:
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
and
dependencies {
compile 'com.github.YO-Uganda:YoPaymentsAndroidAPI:1.0.0'
}
Add Internet Permissions to your Android Manifest file
<uses-permission android:name="android.permission.INTERNET"/>
Initialize the library
YoPay yoAPI = new YoPay(YoAPIUsername, YoAPIPassword);
And that's it! You now have access to the library functions and can make mobile money payments programatically!
Have a user receive the mobile money USSD prompt after clicking a button.
@Override
public void onClick(View v) {
Log.i("YOPAY", "Here we go...");
Log.i("YOPAY", "Clicked Button. Going to callYO now...");
YoPay yoAPI = new YoPay("YoAPIUsername", "YoAPIPassword");
yoAPI.setMsisdn("256712256785");
yoAPI.setAmount(500);
yoAPI.setNarrative("Reason for deposit of funds");
try {
YoPaymentsResponse response = yoAPI.execute("acdepositfunds").get();
Log.i("YOPAY", "" + response.toString());
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}
That's it! You should now be ready to use YoAPI
This project is licensed under the MIT License - see the LICENSE.md file for details