Node Library
Business Rest API Library
Business Service Library is a NodeJS 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
Use the package manager npm to install paga-business.
npm install paga-business
3. Usage
To use PagaBusinessClient, you would need to import it
const PagaBusinessClient = require('paga-business')
To Initialize the module, you use a builder to set all required values
For paga-business version = 2.0.1
const pagaBusinessClient = new PagaBusinessClient().
.setPrincipal("<publicId>")
.setCredential("<password>")
.setApiKey("<apiKey>")
.setIsTest(true)
.build();
For paga-business version <= 1.6.0
const pagaBusinessClient = PagaBusinessClient.Builder()
.setPrincipal("<publicId>")
.setCredential("<password>")
.setApiKey("<apiKey>")
.setIsTest(true)
.build();
As shown above, you set the principal and credential given to you by Paga, If you pass true as the value for setIsTest(), the library will use the test url as the base for all calls. Otherwise setting it to false will use the live url value you pass as the base.
4. Business Service Functions
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 function, call the registerCustomer inside the BusinessClient which will return a JSON for the registered customer.
pagaBusinessClient.registerCustomer(
"referenceNumber",
"customerPhoneNumber",
"customerEmail",
"customerFirstName",
"customerLastName",
"customerDateOfBirth"
).then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
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 function, call the registerCustomerAccountPhoto function inside the BusinessClient Library which will return a JSON.
pagaBusinessClient.registerCustomerAccountPhoto("referenceNumber",
"customerPhoneNumber",
file).then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
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 function, call the registerCustomerIdentification function inside the BusinessClient Library which will return a JSON.
pagaBusinessClient.registerCustomerIdentification("referenceNumber",
"customerPhoneNumber",
"customerIdType",
"customerIdNumber",
"customerIdExpirationDate",
file).then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
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 function, call the moneyTransfer inside the BusinessClient Library which will return a JSON for the money transferred.
pagaBusinessClient.moneyTransfer("referenceNumber",
"amount",
"currency",
"destinationAccount",
"destinationBank",
"senderPrincipal",
"senderCredentials",
"withdrawalCode",
"sourceOfFunds",
"transferReference",
"suppressRecipientMessage",
"locale",
"alternateSenderName",
"minRecipientKYCLevel",
"holdingPeriod").then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
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 function, call the airtimePurchase function inside the BusinessClient Library which will return a JSON for the airtime purchased.
pagaBusinessClient.airtimePurchase("referenceNumber",
"amount",
"currency",
"destinationNumber",
"purchaserPrincipal",
"purchaserCredentials",
"sourceOfFunds",
"locale").then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
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 function, call the merchantPayment function inside the BusinessClient Library which will return a JSON for the merchant payment.
pagaBusinessClient.merchantPayment("merchantReferenceNumber",
"amount",
"merchantAccount",
"referenceNumber",
"currency",
"merchantService",
"purchaserPrincipal",
"purchaserCredentials",
"sourceOfFunds",
"locale").then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
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 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 function, call the validateDepositToBank function inside the BusinessClient Library which will return a JSON for the validate deposit to bank.
pagaBusinessClient.validateDepositToBank("referenceNumber",
"amount",
"currency",
"destinationBankUUID",
"destinationBankAccountNumber",
"recipientPhoneNumber",
"recipientMobileOperatorCode",
"recipientEmail",
"recipientName",
"locale").then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
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 function, call the depositToBank function inside the BusinessClient Library which will return a JSON for the deposit to bank.
pagaBusinessClient.depositToBank("referenceNumber",
"amount",
"currency",
"destinationBankUUID",
"destinationBankAccountNumber",
"recipientPhoneNumber",
"recipientMobileOperatorCode",
"recipientEmail",
"recipientName",
"alternateSenderName",
"suppressRecipientMessage",
"remarks",
"locale").then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
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 function, call the accountBalance function inside the BusinessClient Library which will return a JSON.
pagaBusinessClient.accountBalance("referenceNumber",
"accountPrincipal",
"accountCredentials",
"sourceOfFunds",
"locale").then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
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 function, call the transactionHistory function inside the BusinessClient Library which will return a JSON for the transaction history.
pagaBusinessClient.transactionHistory("referenceNumber",
"accountPrincipal",
"accountCredentials",
"startDateUTC",
"endDateUTC",
"locale").then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
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. The recent transaction history may be executed for the account(s) of the integrated 3rd party or on behalf of another customer with the appropriate authentication. To make use of this function, call the recentTransactionHistory function inside the BusinessClient Library which will return a JSON for the recent transaction history.
pagaBusinessClient.recentTransactionHistory("referenceNumber",
"accountPrincipal",
"accountCredentials",
"locale").then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
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 function, call the getMerchants function inside the BusinessClient Library which will return a JSON.
pagaBusinessClient.getMerchants("referenceNumber", "locale")
.then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
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 function, call the getMerchantServices function inside the BusinessClient Library which will return a JSON.
pagaBusinessClient.getMerchantServices("referenceNumber",
"merchantPublicId",
"locale").then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
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 function, call the getBanks function inside the BusinessClient Library which will return a JSON.
pagaBusinessClient.getBanks("referenceNumber", "locale")
.then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
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 function, call the getOperationStatus function inside the BusinessClient Library which will return a JSON.
pagaBusinessClient.getOperationStatus("referenceNumber","locale")
.then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
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 function, call the getMobileOperators function inside the BusinessClient Library which will return a JSON.
pagaBusinessClient.getMobileOperators("referenceNumber","locale")
.then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
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 function, call the moneyTransferBulk function inside the BusinessClient Library which will return a JSON.
pagaBusinessClient.moneyTransferBulk('bulkReferenceNumber', moneyTransferItems)
.then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
Click here for more info on MoneyTransferItem
Onboard Merchant
The Onboard Merchant operation, allows Aggregator Organisations to create sub organisations on the paga platform.
This operation is only available to Merchant aggregators on the Paga platform.
pagaBusinessClient.onboardMerchant(
'referenceNumber',
merchantExternalId,
merchantInfo,
integration)
.then(resp => {
console.log(resp)
}).catch(function(error) {
console.log(error);
})
Click here to get more info on OnboardMerchant.
Updated over 3 years ago