PHP code example of payherokenya / payhero-php
1. Go to this page and download the library: Download payherokenya/payhero-php 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/ */
payherokenya / payhero-php example snippets
$apiUsername = 'your_api_username';
$apiPassword = 'your_api_password';
$payHeroAPI = new PayHeroAPI($apiUsername, $apiPassword);
$serviceWalletBalance = $payHeroAPI->getServiceWalletBalance();
$paymentWalletBalance = $payHeroAPI->getPaymentWalletBalance();
$topUpResponse = $payHeroAPI->topUpServiceWallet($amount, $phone);
$stkPushResponse = $payHeroAPI->SendCustomerMpesaStkPush($amount, $phone, $channel_id, $external_reference, $callback_url);
$transactionStatus = $payHeroAPI->getTransactionStatus($reference);
$accountTransactions = $payHeroAPI->getAccountTransactions($reference);
$sasapayPaymentResponse = $payHeroAPI-> sasaPayPayment($amount,$phone,$network_code,$external_reference,$callback_url);
$withdrawalResponse = $payHeroAPI->sasaPayWithdrawToMobile($amount,$phone,$network_code,$external_reference,$callback_url);
$withdrawalResponse = $payHeroAPI->sasaPayWithdrawToBank($amount,$account_number,$network_code,$external_reference,$callback_url);
markdown
composer