Giter Site home page Giter Site logo

hubtel-payment's Introduction

Description

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.

Download

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>

Usage

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();
}

Note

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)
		...

FAQ

How do i get a merchant account?

Visit https://unity.hubtel.com/account/signup to create one

How do i get a Client Id and Secret Key?

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.

hubtel-payment's People

Contributors

deluakin avatar edwinnyawoli avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.