1. Go to this page and download the library: Download santosdave/pesawise-wrapper 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/ */
santosdave / pesawise-wrapper example snippets
use Santosdave\PesawiseWrapper\Facades\Pesawise;
// Or inject in your constructor
use Santosdave\PesawiseWrapper\Pesawise;
public function __construct(Pesawise $pesawise)
{
$this->pesawise = $pesawise;
}
use Santosdave\PesawiseWrapper\Pesawise;
class PaymentService
{
protected $pesawise;
public function __construct(Pesawise $pesawise)
{
$this->pesawise = $pesawise;
}
public function processPayment(array $paymentData)
{
return $this->pesawise->createDirectPayment($paymentData);
}
}
$banks = Pesawise::getAllSupportedBanks();
use Santosdave\PesawiseWrapper\Requests\BankRecipientValidationRequest;
$request = new BankRecipientValidationRequest(
bankId: 1,
bankAccountNumber: '1234567890'
);
$recipient = Pesawise::validateBankRecipient($request);
use Santosdave\PesawiseWrapper\Requests\BulkPaymentRequest;
use Santosdave\PesawiseWrapper\DataTypes\Currency;
use Santosdave\PesawiseWrapper\DataTypes\BulkPayment;
use Santosdave\PesawiseWrapper\DataTypes\TransferType;
$bulkPayments = [
new BulkPayment(
amount: 1000,
transferType: new TransferType(TransferType::BANK),
reference: 'REF123',
recipient: 'John Doe',
bankId: 1,
accountNumber: '1234567890'
)
];
$request = new BulkPaymentRequest(
balanceId: 1001002,
currency: new Currency(Currency::KES),
bulkPayments: $bulkPayments
);
$bulkPayment = Pesawise::createBulkPayment($request);