Java Library
Business Rest API Library
Paga has made it very easy for businesses to accept payments. Business Service Library is a Java module that helps you make API calls when processing Paga Business 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/business/business-client/1.0.2
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 Business client dependency under your dependencies
<dependencies>
<dependency>
<groupId>com.paga.business</groupId>
<artifactId>business-client</artifactId>
<version>1.0.2</version>
</dependency>
</dependencies>
Gradle
Add the Paga Business client dependency under your dependencies
compile(group: 'com.paga.business', name: 'business-client', version: '1.0.2')
Also include mavenLocal( ) under your repositories
repositories {
mavenCentral()
mavenLocal()
}
3. Usage
To use BusinessClient, you would need to import it
import <packageName>.BusinessClient;
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
BusinessClient businessClient = new BusinessClient.Builder()
.setPrincipal("<publicId>")
.setApiKey("<apiKey>")
.setCredential("<password>")
.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. Business Service Methods
Register Customer
The Register Customer operation allows 3rd Parties to register customers on Paga. New customers will be contacted to setup their authentication credentials. To make use of this method, call the registerCustomer method inside the BusinessClient which will return a RegisterCustomerResponse for the registered customer.
RegisterCustomerResponse response = businessClient
.registerCustomer(RegisterCustomerRequest
.builder()
.customerEmail("[email protected]")
.customerPhoneNumber("")
.customerDateOfBirth(dateOfBirth)
.customerLastName("Dan")
.customerFirstName("john")
.referenceNumber("doe")
.build());
Register Customer Account Photo
An operation for a business to upload an account photo for a customer account that it has registered. This is useful in case the account photo is not available or the upload fails or is rejected during the initial registration attempt. To make use of this method, call the
registerCustomerAccountPhoto method inside the BusinessClient Library which will return a RegisterCustomerResponse.
RegisterCustomerResponse response = businessClient
.registerCustomerAccountPhoto(RegisterCustomerRequest
.builder()
.customerPhoneNumber("")
.referenceNumber("")
.customerAccountPhoto(file)
.build());
Register Customer Identification
An operation for a business to upload an identification photo for a customer account that it has registered. To make use of this method, call the
registerCustomerIdentification method inside the BusinessClient Library which will return a RegisterCustomerResponse
RegisterCustomerResponse response = businessClient
.registerCustomerIdentification(RegisterCustomerRequest
.builder()
.referenceNumber("")
.customerPhoneNumber("")
.customerIdType("PASSPORT")
.customerIdNumber("0943212123")
.customerIdExpirationDate("2025-07-04")
.customerIdentification(file))
.build());
Money Transfer
The Money Transfer operation enables an integrated 3rd party to utilize the Paga platform to transfer funds from a variety of sources to another party. The funds' transfer may be executed from the accounts of the integrated 3rd party themselves, or on behalf of another customer with the appropriate authentication. The source of funds may be the sender's Paga account or another source that the sender has pre-registered on the Paga platform. To make use of this method, call the
moneyTransfer method inside the BusinessClient Library which will return a MoneyTransferResponse for the money transferred.
MoneyTransferResponse response = businessClient
.moneyTransfer(MoneyTransferRequest
.builder()
.alternateSenderName("")
.amount(3000)
.currency("NGN")
.destinationAccount("")
.destinationBank("")
.holdingPeriod(31)
.minRecipientKYCLevel("KYC1")
.referenceNumber("")
.locale("NG")
.senderCredentials("")
.senderPrincipal("")
.sourceOfFunds("PAGA")
.suppressRecipientMessage(true)
.transferReference("")
.sendWithdrawalCode(false)
.build());
Airtime Purchase
The Airtime Purchase operation enables an integrated 3rd party to utilize the Paga platform to purchase airtime for any phone number on any of the major networks. The purchase can be funded by the integrated 3rd party themselves, or on behalf of another customer with the appropriate authentication. The source of funds may be the purchaser's Paga account or another source that the sender has pre-registered on the Paga platform.
To make use of this method, call the airtimePurchase method inside the BusinessClient Library which will return an AirtimePurchaseResponse for the airtime purchased.
AirtimePurchaseResponse response = businessClient
.airtimePurchase(AirtimePurchaseRequest
.builder()
.amount(100)
.currency("NGN")
.destinationPhoneNumber("")
.locale("NG")
.purchaserPrincipal(null)
.purchaserCredentials(null)
.sourceOfFunds("PAGA")
.referenceNumber("")
.build() );
Merchant Payment
The Merchant Payment operation enables an integrated 3rd party to utilize the Paga platform to make payments to registered merchants. The purchase can be funded by the integrated 3rd party themselves, or on behalf of another customer with the appropriate authentication. The source of funds may be the purchaser's Paga account or another source that the sender has pre-registered on the Paga platform. To make use of this method, call the merchantPayment method inside the BusinessClient Library which will return a MerchantPaymentResponse for the merchant payment.
List<String> merchantServices = new ArrayList<>();
merchantServices.add("");
MerchantPaymentResponse response = businessClient
.merchantPayment(MerchantPaymentRequest
.builder()
.amount(1500.00)
.currency("NGN")
.locale("NG")
.merchantAccount("")
.merchantService(merchantServices)
.merchantReferenceNumber("1234567890")
.referenceNumber("")
.build());
Validate Deposit to Bank
The Validate Deposit To Bank operation enables an integrated 3rd party to pre-validate a potential deposit to bank operation using similar parameters that would be provided for the actual deposit to bank operation. This will return a result indicating whether the actual deposit to bank operation using the same parameters is likely to be successful or not, and if not, why not. This will also validate the bank account number for the bank provided and return the account holder's name for that account as stored at the bank. This will also return any fees that would be charged as part of the actual deposit to bank operation. To make use of this method, call the validateDepositToBank method inside the BusinessClient Library which will return a ValidateDepositToBankResponse for the validate deposit to bank.
ValidateDepositToBankResponse response = businessClient
.validateDepositToBank(ValidateDepositToBankRequest
.builder()
.amount(10000)
.currency("NGN")
.destinationBankAccountNumber("1234567890")
.destinationBankUUID("")
.locale("NG")
.recipientEmail("")
.recipientMobileOperatorCode("")
.recipientName("")
.recipientPhoneNumber("")
.referenceNumber()
.build());
Deposit To Bank
The Deposit To Bank operation enables an integrated 3rd party to utilize the Paga platform to deposit funds to any bank account. The funds will be deposited from the businesses Paga account to the bank via the bank account specified in the operation parameters. To make use of this method, call the depositToBank method inside the BusinessClient Library which will return a DepositToBankResponse for the deposit to bank.
DepositToBankResponse response = businessClient
.depositToBank(DepositToBankRequest
.builder()
.alternateSenderName("")
.amount(10000)
.currency("NGN")
.destinationBankAccountNumber("1234567890")
.destinationBankUUID("")
.locale("NG")
.recipientEmail("")
.recipientMobileOperatorCode("")
.recipientName("")
.recipientPhoneNumber("")
.referenceNumber("")
.remarks("transfer")
.suppressRecipientMessage(true)
.build() );
Account Balance
The Account Balance operation enables an integrated 3rd party to utilize the Paga platform to check the balance of a Paga account or any other account type pre-registered on the Paga platform, which supports balance inquiries. To make use of this method, call the accountBalance method inside the BusinessClient Library which will return a AccountBalanceResponse for the account balance method.
AccountBalanceResponse response = businessClient
.accountBalance(AccountBalanceRequest
.builder()
.accountCredentials("")
.accountPrincipal("")
.locale("NG")
.referenceNumber("")
.sourceOfFunds("Paga")
.build());
Transaction History
The Transaction History operation enables an integrated 3rd party to utilize the Paga platform to check the transaction history of their Paga account between selected date ranges. Transactions results are limited to the most recent 10,000 results. To make use of this method, call the transactionHistory method inside the BusinessClient Library which will return a TransactionHistoryResponse for the transaction history.
TransactionHistoryResponse response = businessClient.
transactionHistory(TransactionHistoryRequest
.builder()
.accountCredentials("")
.accountPrincipal("")
.endDateUTC(date2)
.locale("NG")
.referenceNumber("")
.startDateUTC(date1)
.build());
Recent Transaction History
The Recent Transaction History operation enables an integrated 3rd party to utilize the Paga platform to check the last 5 transactions on their Paga account. To make use of this method, call the recentTransactionHistory method inside the BusinessClient Library which will return a RecentTransactionHistoryResponse for the recent transaction history.
RecentTransactionHistoryResponse response = businessClient
.recentTransactionHistory(RecentTransactionHistoryRequest
.builder()
.accountCredentials("")
.accountPrincipal("")
.locale("NG")
.referenceNumber("")
.build());
Get Merchants
The Get Merchants operation enables an integrated 3rd party to utilize the Paga platform to obtain a list of registered merchants on the Paga platform, typically for use in parameterizing the merchant payment operation. To make use of this method, call the getMerchants method inside the BusinessClient Library which will return a GetMerchantResponse for the get Merchants method.
GetMerchantResponse response = businessClient
.getMerchants(GetMerchantsRequest
.builder()
.locale("")
.referenceNumber("")
.build());
Get Merchant Services
The Get Merchants Services operation enables an integrated 3rd party to utilize the Paga platform to obtain a list of registered services and service details for a given registered merchant on the Paga platform, typically for use in parameterizing the merchant payment operation. To make use of this method, call the getMerchantServices method inside the BusinessClient Library which will return a GetMerchantServicesResponse for the get Merchant services method.
GetMerchantServicesResponse response = businessClient
.getMerchantServices(GetMerchantServicesRequest
.builder()
.referenceNumber("")
.locale("NG")
.merchantPublicId("")
.build());
Get Banks
The Get Banks operation enables an integrated 3rd party to utilize the Paga platform to obtain a list of available banks on the Paga platform, typically for use in parameterizing the deposit to bank operation. To make use of this method, call the getBanks method inside the BusinessClient Library which will return a GetBanksResponse for the get banks method.
GetBanksResponse response = businessClient
.getBanks(GetBanksRequest
.builder()
.locale("NG")
.referenceNumber(generateRandomString())
.build());
Get Operation Status
The Get Operation Status operation allows an integrated 3rd party to check on the status of a previous operation using the operation's reference number. To make use of this method, call the getOperationStatus method inside the BusinessClient Library which will return a GetOperationStatusResponse for the get operation status method.
GetOperationStatusResponse response = businessClient
.getOperationStatus(GetOperationStatusRequest
.builder()
.referenceNumber("mer-1571156229476")
.locale("NG")
.build());
Get Mobile Operators
The Get Mobile Operators operation enables an integrated 3rd party to utilize the Paga platform to obtain a list of available mobile operators on the Paga platform, typically for use in parameterizing the various operations of the business API. To make use of this method, call the getMobileOperators method inside the BusinessClient Library which will return a GetMobileOperatorsResponse .
GetMobileOperatorsResponse mobileOperators = businessClient .getMobileOperators(GetMobileOperatorsRequest
.builder()
.referenceNumber(generateRandomString())
.locale("NG")
.build());
Bulk Money Transfer
The Bulk Money Transfer operation enables an integrated 3rd party to utilize the Paga platform to execute the money transfer operation described above to multiple recipients simultaneously. This is limited to 300 payment items per bulk operation. To make use of this method, call the moneyTransferBulk method inside the BusinessClient Library which will return a MoneyTransferBulkResponse .
List<MoneyTransferItem> moneyTransferItems = new ArrayList<>();
moneyTransferItems.add(MoneyTransferItem.builder()
.alternateSenderName(null)
.amount("3000")
.currency("NGN")
.destinationAccount("")
.senderPrincipal(null)
.destinationBank("")
.holdingPeriod(31)
.minRecipentKYCLevel("KYC1")
.sourceOfFunds("PAGA")
.sendWithdrawalCode(false)
.suppressRecipientMessage(true)
.senderCredentials(null)
.transferReference("")
.referenceNumber("")
.build());
MoneyTransferBulkResponse response = businessClient
.moneyTransferBulk(MoneyTransferBulkRequest
.builder()
.bulkReferenceNumber()
.moneyTransferItems(moneyTransferItems)
.build());
Click here for more info on MoneyTransferItem
Onboard Merchant
The Onboard Merchant operation, allows Aggregator Organisations to create sub organisations on Paga platform.
OnboardingResponse response= businessClient
.onboardMerchant(OnboardMerchantRequest
.builder()
.reference("")
.merchantExternalId("")
.integration(Integration.builder()
.callbackUrl("")
.username("")
.password("")
.type("")
.financeAdminEmail("")
.build())
.merchantInfo(MerchantInfo.builder()
.additionalParameters(AdditionalParameters
.builder()
.displayName("")
.establishedDate(date)
.websiteUrl("")
.build())
.legalEntity(LegalEntity
.builder()
.addressCity("")
.addressCountry("")
.addressLine1("")
.addressLine2("")
.addressZip("23401")
.description("")
.name("")
.addressState("")
.build())
.legalEntityRepresentative(LegalEntityRepresentative
.builder()
.dateOfBirth(dob)
.email("")
.firstName("")
.lastName("")
.phone("")
.build())
.build())
.build());
This operation is only available to Merchant aggregators on the Paga platform.
Click here to get more info on OnboardMerchant.
Updated over 3 years ago