1. Go to this page and download the library: Download redde/php-api-sdk 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/ */
redde / php-api-sdk example snippets
$api = new ReddeApi(API_KEY, APP_ID);
/**
* An example of using the Redde Api to receive money
*/
clude 'config.php';
use Redde\Exceptions\ReddeApiException;
use Redde\Exceptions\ReddeException;
use Redde\ReddeApi;
/* Replace this with your API key and App Id
You can also insert the apikey and appid here directly
and ignore the config.php file
*/
$apikey = $config['apikey'];
$app_id = $config['appid'];
$api = new ReddeApi($apikey, $app_id);
/* Note that the clienttransid and clientreference is generated
by the developer. The nickname is your identity name eg. Wigal
*/
$params = [
"amount" => 1, //amount to receive
"appid" => $config['appid'], //your app id
"clientreference" => client_reference_here, //client reference from your side
"clienttransid" => client_transaction_id_here, //client transaction id from your side
"description" => "Recieving payment from {$client_reference_here}", //A description for the transaction performed
"nickname" => "nickname_here", //a name to give to who is paying
"paymentoption" => "MTN", //payment options are MTN|AIRTELTIGO|VODAFONE
"vouchercode" => "", //this is optional for vodafone
"walletnumber" => "024XXXXXXX" //the mobile number to use
];
/**
* Call receiveMoney function and pass
* the payload as parameter. This will
* return a response which you can save
* in any storage of your choice
*/
$api->receiveMoney($params);
/**
* An example of using the Redde Api to send money
*/
ons\ReddeException;
use Redde\ReddeApi;
/* Replace this with your API key and App Id
You can also insert the apikey and appid here directly
and ignore the config.php file
*/
$apikey = $config['apikey'];
$app_id = $config['appid'];
$api = new ReddeApi($apikey, $app_id);
/* Note that the clienttransid and clientreference is generated
by the developer. The nickname is your identity name eg. Wigal
*/
$params = [
"amount" => 1, //amount to receive
"appid" => $config['appid'], //your app id
"clientreference" => client_reference_here, //client reference from your side
"clienttransid" => client_transaction_id_here, //client transaction id from your side
"description" => "Sending payment from {$client_reference_here}", //A description for the transaction performed
"nickname" => "nickname_here", //a name to give to who is paying
"paymentoption" => "MTN", //payment options are MTN|AIRTELTIGO|VODAFONE
"walletnumber" => "024XXXXXXX" //the mobile number to use
];
/**
* Call receiveMoney function and pass
* the payload as parameter. This will
* return a response which you can save
* in any storage of your choice
*/
$api->sendMoney($params);
/**
* A simple implementation of callback
* on Redde Api
*/
ReddeException;
use Redde\Webhooks\WebHookStatus;
$status = new WebHookStatus(); //instantiate an object
$data = $status->callback(); //get callback and set it to a variable
echo $data->reason; //output any data e.g. status|reason| etc
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.