Hubtel Payment android library allows you to easily integrate hubtel payment gateway into your android app and start accepting payments from within your android app.
Hubtel Payment supports Mobile Wallets(MTN, Airtel, Tigo, Vodafone) & Bank Cards payment.
You'll need to signup for a hubtel merchant account https://unity.hubtel.com/account/signup, also you will need a ClientID and a Secret Key https://unity.hubtel.com/account/api-accounts-add.
Add a dependency using Gradle:
Add it in your root build.gradle(Project) at the end of repositories
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add it in your build.gradle(Module)
dependencies {
...
compile 'com.github.deluakin:hubtel-payment:v1.3'
}
Add a dependency using Maven:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.deluakin</groupId>
<artifactId>hubtel-payment</artifactId>
<version>v1.2</version>
</dependency>
Simple use case will look something like this:
try {
SessionConfiguration sessionConfiguration = new SessionConfiguration()
.Builder().setClientId("CLIENT-ID")
.setSecretKey("SECRET-KEY")
.setEnvironment(Environment.LIVE_MODE)
.build();
HubtelCheckout hubtelPayments = new HubtelCheckout(sessionConfiguration);
hubtelPayments.setPaymentDetails(1.5, "This is a demo payment");
hubtelPayments.Pay(this);
hubtelPayments.setOnPaymentCallback(new OnPaymentResponse() {
@Override
public void onFailed(String token, String reason) {
}
@Override
public void onCancelled() {
}
@Override
public void onSuccessful(String token) {
}
});
}
catch (HubtelPaymentException e) {
e.printStackTrace();
}
TEST_MODE environment is not supported yet.
SessionConfiguration sessionConfiguration = new SessionConfiguration()
...
.setEnvironment(Environment.TEST_MODE)
...
Make sure to switch the Environment to LIVE_MODE when releasing your app to the public
SessionConfiguration sessionConfiguration = new SessionConfiguration()
...
.setEnvironment(Environment.LIVE_MODE)
...
Visit https://unity.hubtel.com/account/signup to create one
You will need to register an App. To do that, go to this url https://unity.hubtel.com/account/api-accounts-add. Make sure the "API TYPE" selected is "HTTP REST API". After registering an App, Hubtel will automatically generate a Client ID and a Client Secret.