PHP code example of paga / paga-business

1. Go to this page and download the library: Download paga/paga-business library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

paga / paga-business example snippets





$businessClient = PagaBusinessClient::builder()
                ->setApiKey("<apiKey>")
                ->setPrincipal("<publicId>")
                ->setCredential("<password>")
                ->setTest(true)
                ->build();

$response = $businessClient ->registerCustomer(
    "referenceNumber",
    "customerPhoneNumber",
    "customerFirstName",
    "customerLastName",
    "customerEmail",
    "customerDateOfBirth",
)


$response = $businessClient -> registerCustomerIdentification(
  $reference_number,
  $customerPhoneNumber, 
  $customerIdType, 
  $customerIdNumber,
  $customerIdExpirationDate, 
  $idPhoto_path
);
  
$response = $businessClient ->moneyTransfer(
  $referenceNumber,
  $amount, 
  $destinationAccount,
  $senderPrincipal, 
  $senderCredentials,
  $currency
  );


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

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

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

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

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

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

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

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

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

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

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

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

$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);

$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);