PHP Library

Business Rest API Library

Paga has made it very easy for businesses to accept payments.This Business Service Library is a PHP 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

 composer require paga/paga-business

3.Usage

To use PagaBusinessClient, you would need to import it

require_once __DIR__ .'/vendor/autoload.php
use PagaBusiness\PagaBusinessClient;

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 = PagaBusinessClient::builder()
                ->setApiKey("<apiKey>")
                ->setPrincipal("<publicId>")
                ->setCredential("<password>")
                ->setTest(true)
                ->build();

📘

Note

Test Server can be true or false. True means you are 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 set up their authentication credentials. To make use of this function, call the registerCustomer inside the BusinessClient which will return a JSON for the registered customer.

$response = $businessClient ->registerCustomer("ref-12345", "07099276199", "Folade", "Seyinde",  "[email protected]",
    "1990-03-13" );

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 PagaBusinessClient Library which will return a JSON.

$response = $businessClient ->registerCustomerAccountPhoto($reference_number, $customerPhoneNumber, $passportPhoto_path);

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 PagaBusinessClient Library which will return a JSON.

$response = $businessClient -> registerCustomerIdentification(
$reference_number, $customerPhoneNumber, $customerIdType, $customerIdNumber,$customerIdExpirationDate, $idPhoto_path);

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 PagaBusinessClient Library which will return a JSON for the money transferred.

$response = $businessClient ->moneyTransfer($referenceNumber,$amount, $destinationAccount,$senderPrincipal, $senderCredentials,
        $currency,$destinationBank,$sendWithdrawalCode,$transferReference,$sourceOfFunds,$suppressRecipientMessage,$locale,$alternateSenderName,$minRecipientKYCLevel,$holdingPeriod);

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 PagaBusinessClient Library which will return a JSON for the airtime purchased.

$response = $businessClient ->airtimePurchase($referenceNumber,$amount,$phoneNumber);

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 PagaBusinessClient Library which will return a JSON for the merchant payment.

$response = $businessClient-> merchantPayment($reference_number, $amount, $merchantAccount, $merchantReferenceNumber, $currency, $merchantService);

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 PagaBusinessClient Library which will return a JSON for the deposit to bank.

$response = $businessClient-> depositToBank($reference_number, $amount,$destinationBankUUID, $destinationBankAccountNumber, $recipientPhoneNumber, $currency)

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 PagaBusinessClient Library which will return a JSON for the validate deposit to bank.

$response = $businessClient-> validateDepositToBank($reference_number, $amount, $destinationBankUUID, $destinationBankAccountNumber);

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 PagaBusinessClient Library which will return a JSON for the account balance method.

$response = $businessClient-> accountBalance($reference_number);

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 JSON for the transaction history.

$response = $businessClient-> transactionHistory($reference_number);

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 JSON for the recent transaction history.

$response = $businessClient-> recentTransactionHistory($reference_number);

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 PagaBusinessClient Library which will return a JSON for the get Merchants method.

$response = $businessClient-> getMerchants($reference_number);

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 PagaBusinessClient Library which will return a JSON for the get Merchant services method.

$response = $businessClient-> getMerchantServices($reference_number, $merchantPublicId);

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 PagaBusinessClient Library which will return a JSON for the get banks method.

$response = $businessClient-> getBanks($reference_number);

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 PagaBusinessClient Library which will return a JSON for the get operation status method.

$response = $businessClient -> getOperationStatus($reference_number);

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 PagaBusinessClient Library which will return a JSON.

$response = $businessClient -> getMobileOperators($reference_number);

Money Transfer Bulk

The Money Transfer Bulk 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 JSON .

$bulkReferenceNumber = "ref-123";
$items_arr = array(
                   array('referenceNumber'=>$referenceNumber_1,
                        'amount'=>$amount_1,
                        'destinationAccount'=>$phonenumber_1,
                        'senderPrincipal'=>$senderPrincipal_1,
                        'senderCredentials'=>$senderCredentials_1,
                        'currency'=>$currency_1
                   ),

                   array('referenceNumber'=>$referenceNumber_2,
                         'amount'=>$amount_2,
                         'destinationAccount'=>$phonenumber_2,
                         'senderPrincipal'=>$senderPrincipal_2,
                         'senderCredentials'=>$senderCredentials_2,
                         'currency'=>$currency_2
                   )
						);
$response = $businessClient -> moneyTransferBulk($bulkReferenceNumber, $items_arr);

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.

Click here to get more info on OnboardMerchant.

$legalEntity = array (
    "name"=> "",
    "description"=>"",
    "addressLine1"=>"",
    "addressLine2"=>"",
    "addressCity"=>"",
    "addressState"=>"",
    "addressZip"=>"",
    "addressCountry"=>"");

$legalEntityRepresentative = array (
    "firstName"=>"",
    "lastName"=>"",
    "dateOfBirth"=>"",
    "phone"=>"",
    "email"=>""
);

$integration = array(
    "type"=>""
);

$merchantInfo = array( "legalEntity"=> legalEntity, "legalEntityRepresentative"=> $legalEntityRepresentative);

$response = $businessClient_test -> onboardMerchant($reference, $merchantExternalId, $merchantInfo, $integration);

Validate Customer

The validate Customer operation enables an organization to get the details of the user like
identifierType and KYC level of the user. To make use of this method, call the validateCustomer method inside the BusinessClient Library which will return a JSON

$response = $businessClient->validateCustomer($reference_number, $customerIdentifier);