Java Library

Paga Collect Java library

The Paga Collect API allows anyone to initiate a payment request to a third party and automatically get notified when the payment request is fulfilled. This library makes it easier and faster for developers to integrate the API

1. Installation

Download the jar and install it in your project

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

Step 1. Extract and add the downloaded package to ~/.m2 directory

- path ~/.m2/repository/com/pagatech/collect-lib/1.0.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 Business client dependency under your dependencies



Add the Paga Collect library dependency under your dependencies

//include mavenLocal( ) under your repositories
repositories {

dependencies {
    compile(group: 'com.pagatech', name: 'collect-lib', version: '1.0.0')


2. Usage

Once installed to import the library

import <packageName>.Collect;

Initialize it, see sample code below:

Collect collect = new Collect.Builder()

Test Server can be true or false. True means you calling PAGA test server while False means you are calling PAGA live Server.

Paga Collect API Operations

Now that you have created a collect object you easily call its operations

Request Payment

Register a new request for payment between a payer and a payee. Once a payment request is initiated successfully, the payer is notified by the platform (this can be suppressed) and can proceed to authorize/execute the payment. Once the payment is fulfilled, a notification is sent to the supplied callback URL. See the callback notification section for more details.

To make a payment request see sample code below:

PaymentRequestRequest.Payer payer = new PaymentRequestRequest.Payer();
payer.setName("John Doe");
PaymentRequestRequest.Payee payee = new PaymentRequestRequest.Payee();
payee.setName("Mary Doe");

List<String> paymentMethods = new ArrayList<>();

PaymentRequestResponse paymentRequestResponse = collect.paymentRequest(PaymentRequestRequest.builder()


Register Persistent Payment Account

An operation for businesses to create Persistent Payment Account Numbers that can be assigned to their customers for payment collection.

To create a persistent payment account see the sample code below:

RegisterPersistentPaymentAccountResponse response = collect.registerPersistentPaymentAccount(
                .accountName("John Doe")


Query Status

Query the current status of a submitted request

To check the status of a submitted request see the sample code below:

StatusResponse statusResponse = collect.getStatus(StatusRequest.builder()

Query History

Get payment requests for a period between given start and end dates. The period window should not exceed 1 month.

See sample code below:

HistoryResponse historyResponse = collect.getHistory(HistoryRequest.builder()


Get Banks

Retrieve a list of supported banks and their complementary unique ids on the bank. This is required for populating the payer (optional) and payee objects in the payment request model.

See usage sample code below:

BanksResponse banks = collect.getBanks(BanksRequest.builder()


Payment Request Refund

This end-point can be used to either cancel or initiate a refund if we were unable to fulfill the request for one reason or the other.

See usage sample code below:

RefundPaymentResponse refundPaymentResponse = collect.refund(
                        .reason("no particular reason")

Delete Persistent Payment Account

This endpoint allows for deleting a persistent payment account.

See usage sample code below:

DeletePersistentPaymentAccountResponse deletePersistentPaymentAccountResponse = collect.deletePersistentPaymentAccount(
                        .reason("Duplicate account")

Get Persistent Payment Account

A method to query the properties associated with an existing persistent payment account.

See usage sample code below:

GetPersistentPaymentAccountResponse getPersistentPaymentAccountResponse = collect.getPersistentPaymentAccount(

Update Persistent Payment Account

This endpoint allows for changing any of the account properties except the accountNumber (NUBAN) and the accounReference properties which cannot be changed.

See usage sample code below:

UpdatePersistentPaymentAccountResponse updatePersistentPaymentAccountResponse = collect.updatePersistentPaymentAccount(
                .accountName("Joe Manchin")