Java Library

Merchant Service

Merchant Services is a Java module that helps you make API calls when processing Paga Transactions.

1. Create Paga 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/merchant/merchant-client/1.0

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

Maven

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

Then add the Paga Merchant client dependency under your dependencies

<dependencies>
     <dependency>
            <groupId>com.paga.merchant</groupId>
            <artifactId>merchant-client</artifactId>
            <version>1.0</version>
        </dependency>
</dependencies>

Gradle

Add the Paga Merchant client dependency under your dependencies

compile 'com.paga.merchant:merchant-client:1.0'

Also include mavenLocal( ) under your repositories

repositories {
    mavenCentral()
    mavenLocal()
}

3. Usage

To use MerchantServiceClient, you would need to import it

import <packageName>.MerchantServiceClient;

To Initialise the class, use your Paga api key, credential(password), principal(public id) and PAGA server base url. To get your Paga API key, click on Getting started

MerchantServiceClient merchantServiceClient = new MerchantServiceClient.Builder()
                                 .setApiKey("<apiKey>")
                                 .setCredential("<password>")
                                 .setPrincipal("<publicId>")
                                 .setTest(true).build();

📘

Note

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

4. Merchant Service Method

Get Transaction Details

To verify the status and details of an executed process or to determine if a transaction was indeed executed on the system using the pre-shared transaction reference number, you call getTransactionDetails method inside MerchantServiceClient and it returns GetTransactionDetailResponse

GetTransactionDetailResponse response = merchantServiceClient
                    .getTransactionDetails(GetTransactionDetailsRequest.builder()
                    .referenceNumber("326t7y8389")
                    .build());

Get Transaction Details by Invoice Number

To verify the status and details of an executed process or to determine if a transaction was indeed executed on the system using the pre-shared transaction invoice number, call getTransactionDetailsByInvoiceNumber method inside MerchantServiceClient and it returns GetTransactionDetailsByInvoiceNumberResponse.

GetTransactionDetailsByInvoiceNumberResponse response = merchantServiceClient.
                                     getTransactionDetailsByInvoiceNumber
                                     (GetTransactionDetailsByInvoiceNumberRequest
                                     .builder()
                                     .invoiceNumber("")
                                     .build());

Get Process Details

To determine if a process was indeed executed on the system using the pre-shared process code, call getProcessDetails method inside MerchantServiceClient and it returns a GetProcessDetailsResponse

GetProcessDetailsResponse response = merchantServiceClient.
                             getProcessDetails(GetProcessDetailsRequest.builder()
                            .processCode("")
                            .build());

Reconciliation Report

To retrieve reconciled reports on the date range provided containing list of processes and transactions call getReconcilationReport method inside MerchantServiceClient and it returns a ReconciliationReportResponse

ReconciliationReportResponse response = merchantServiceClient.
                               getReconcilationReport(ReconciliationReportRequest
                              .builder()
                              .periodStartDateTimeUTC(date1)
                              .periodEndDateTimeUTC(date2)
                              .build());

Get Foreign Exchange Rate

To determine the exchange rate call getForeignExchange method inside MerchantServiceClient and it returns a GetForeignExchangeRateResponse.

GetForeignExchangeRateResponse response = merchantServiceClient
                                    .getForeignExchange(GetForeignExchangeRequest
                                    .builder()
                                    .baseCurrency("NGN")
                                    .foreignCurrency("USD")
                                    .build());

Refund Bill Pay

To fully or partially refund bill payment previously made by a customer call refundBillPay method inside MerchantServiceClient and it returns a RefundPaymentResponse.

RefundPaymentResponse response =  merchantServiceClient
                                .refundBillPay(RefundPaymentRequest.builder()
                                .currency("NGN")
                                .customerPhoneNumber("")
                                .fullRefund(true)
                                .includesCustomerFee(false)
                                .reason("reason")
                                .referenceNumber("")
                                .refundAmount(1500.00)
                                .build());

What’s Next