Java Library

Paga-connect Java Library is a Java module that helps you make API calls when processing Paga Transactions.

1. Create Paga Business Account

You need to create a Paga business account

2. Installation

Download the jar to your project.

If you are using build file such as Maven or Gradle, follow the process below,

Step 1. add the downloaded jar to .m2 directory

  • path .m2/repository/com/paga/connect/paga-connect/1.0

Step 2. Add the dependency to your pom.xml or build.gradle file.


Go to your pom file and add the following to your pom.xml

Then add the Paga Connect dependency under your dependencies



Add the Paga Connect dependency under your dependencies

compile 'com.paga.connect:paga-connect:1.0'

Also include mavenLocal( ) under your repositories

repositories {

3. Usage

To use PagaConnectRestClient, you would need to import it

import <packageName>.PagaConnectRestClient;

To Initialize the class, you use a builder to set all required values

PagaConnectClient pagaConnectClient = new PagaConnectClient.Builder()
                .setUserData(new String[]{"FIRST_NAME+LAST_NAME+USERNAME+EMAIL+ACCOUNT_BALANCE"})

As shown above, you set the client id and secret given to you by Paga, then set your Redirect URL, scope and User data are arrays of strings and are required to inform Paga-connect which data and operations you would need and initiate for the user.

4. Paga Connect Functions

Authorisation Code

To obtain your authorisation code, click here

Access Token

Map<String,String>accessToken = pagaConnectClient

Make Payments

This is the operation executed to make a payment to you on behalf of the customer. To make use of this function, call the getAccessToken inside the ConnectClient which will return a response with the access token which will be used to complete payment.

To get Access tokens, Use the authorization code gotten from the call to the backend :

MerchantPaymentResponse response =  pagaConnectClient

Money Transfer

This operation allows you to credit a user's paga account. To make use of this function, call the moneyTransfer inside the ConnectClient which will return a MoneyTransferResponse.

Access Token is used in making money transfer like this:

MoneyTransferResponse response =  pagaConnectClient

User Details

This Operation allows the client to get the user's personal details. The data requested is included in the authentication and authorization request in the data parameter. Additionally, the scope parameter must contain the USER_DETAILS_REQUEST option. To make use of this function, call the getUserDetails inside the ConnectClient which will return a UserDetailResponse with user details.

Map<String, String> accessToken =  pagaConnectRestClient.getAccessToken(authorization_code);

Access Token is used in getting user details like this:

UserDetailResponse response = pagaConnectClient

What’s Next