1. Go to this page and download the library: Download paychangu/laravel 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/ */
paychangu / laravel example snippets
return [
/*
|--------------------------------------------------------------------------
| PayChangu API Private Key
|--------------------------------------------------------------------------
|
| This is the private key used to authenticate with the PayChangu API.
|
*/
'private_key' => env('PAYCHANGU_API_PRIVATE_KEY'),
/*
|--------------------------------------------------------------------------
| PayChangu API Base URL
|--------------------------------------------------------------------------
|
| This is the root URL for the PayChangu API.
| Specific endpoints (checkout, mobile-money) will be constructed from this.
|
*/
'api_base_url' => env('PAYCHANGU_API_BASE_URL', 'https://api.paychangu.com/'),
];
$response = Paychangu::create_mobile_money_payment([
'mobile' => '0999123456', // Phone number in format 265... or 099...
'mobile_money_operator_ref_id' => 'mpamba_ref_id', // Get from mobile_money_operators()
'amount' => 1000,
'charge_id' => 'unique_charge_id_123', // Must be unique for every transaction
]);