1. Go to this page and download the library: Download codemojo/startkit 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/ */
codemojo / startkit example snippets
nst CLIENT_ID = '[email protected]';
const CLIENT_SECRET = 'PLB6DHP7VcykRDdvloi2X9tEq3FvsIBhtdn7UdeQ';
// Create an instance of Authentication Service
$authService = new AuthenticationService(CLIENT_ID, CLIENT_SECRET, Endpoints::LOCAL, function($type, $message){
switch($type){
case Exceptions::AUTHENTICATION_EXCEPTION:
echo 'Authentication Exception';
break;
case Exceptions::BALANCE_EXHAUSTED_EXCEPTION:
echo 'Low balance';
break;
case Exceptions::FIELDS_MISSING_EXCEPTION:
echo 'Fields missing';
break;
case Exceptions::QUOTA_EXCEPTION:
echo 'Quota Exhausted Exception';
break;
case Exceptions::TOKEN_EXCEPTION:
echo 'Invalid token Exception';
break;
default:
echo 'Error ' . $message;
break;
}
});
// Create an instance of Loyalty Service - If you have more than one wallet service,
// you can optionally pass in the wallet instance as the second argument
$loyaltyService = new LoyaltyService($authService);
// Credit points to user - You can have different set of rules based on the platform
// For example, you can promote your android app by saying Get 5% more cashback when you transact through the Android app
$status = $loyaltyService->addLoyaltyPoints("[email protected]", 1500, "android", "", 7, "Cashback for Order no. 1231");
// Get the balance in the wallet
$balance = $loyaltyService->getBalance("[email protected]");
// Check how much maximum can be redeemed by the user for the given (current) transaction value
// Again, you can have different set of rules for redemption based on the platform
$maximumRedemption = $loyaltyService->maximumRedemption("[email protected]",8500);
// Redeem amount
// (user_id, redemption_amount, current_transaction_value, platform)
$loyaltyService->redeem("[email protected]", 500, 8500, "android");
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.