git clone git@github.com:gsmainclusivetechlab/mmapi-php-sdk.git -b develop
export MMAPI_PHP_SDK=$(pwd)/mmapi-php-sdk
cd $MMAPI_PHP_SDK
Install Composer.
From the root of the mmapi-php-sdk project, type:
composer install
consumer_key=<consumer_key>
consumer_secret=<consumer_secret>
api_key=<api_key>
callback_url=<callback_url>
<?php
//require the autoload file
require dirname(__DIR__, 1) . '/autoload.php';
//Parse the config file
$env = parse_ini_file(__DIR__ . '../../config.env');
use mmpsdk\\Common\\Constants\\MobileMoney;
use mmpsdk\\Common\\Enums\\SecurityLevel;
use mmpsdk\\Common\\Exceptions\\SDKException;
//Initialize SDKa
try {
MobileMoney::initialize(
MobileMoney::SANDBOX,
$env['consumer_key'],
$env['consumer_secret'],
$env['api_key']
);
MobileMoney::setCallbackUrl($env['callback_url']);
MobileMoney::setSecurityLevel(SecurityLevel::DEVELOPMENT);
} catch (SDKException $exception) {
prettyPrint($exception->getMessage());
}
function prettyPrint($data)
{
echo PHP_EOL . print_r($data, true) . PHP_EOL;
}
print("Consumer Key : " . MobileMoney::getConsumerKey() . PHP_EOL);
print("Consumer Secret : " . MobileMoney::getConsumerSecret() . PHP_EOL);
print("API Key : " . MobileMoney::getApiKey() . PHP_EOL);
print("Environment : " . MobileMoney::getEnvironment() . PHP_EOL);
print("Security Level : " . MobileMoney::getSecurityLevel() . PHP_EOL);
print("Callback URL : " . MobileMoney::getCallbackUrl() . PHP_EOL);
print("MMAPI URL : " . MobileMoney::getBaseUrl() . PHP_EOL);
?>