Skip to content

deluakin/hubtel-online-checkout

Repository files navigation

GitHub issues GitHub forks GitHub stars GitHub license

Description

This android library allows you to easily integrate hubtel online checkout into your android app and start accepting payments from within your app. Hubtel Payment supports Mobile Wallets & Bank Cards payment. You'll need to signup for a merchant account.

Download

Add a dependency using Gradle:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}
dependencies {
	...
	implementation 'com.github.deluakin:hubtel-online-checkout:v1.4'
}

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-online-checkout</artifactId>
	<version>v1.4</version>
</dependency>

Usage

Simple use case will look something like this:

try {
	SessionConfiguration sessionConfiguration = new SessionConfiguration()
		.Builder().setClientId("CLIENT-ID")
		.setSecretKey("SECRET-KEY")
		.setMerchantAccountNumber("HUBTEL-ACC-NO")
		.build();
	HubtelCheckout hubtelPayments = new HubtelCheckout(sessionConfiguration);
	hubtelPayments.setPaymentDetails(150.50, "Pepperoni Pizza XL");
	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();
}