Jump to content
MakeWebGames

add a donator payment option


GuyiGooG

Recommended Posts

Looks fairly simple if you look at their API sample script.

<?phpdefine('SECRET', 'd9bee051cfe5613c6a2ddb513ad52fd9');
define('CREDIT_TYPE_CHARGEBACK', 2);


$ipsWhitelist = array(
       '174.36.92.186',
       '174.36.96.66',
       '174.36.92.187',
       '174.36.92.192',
       '174.37.14.28'
);
$userId = isset($_GET['uid']) ? $_GET['uid'] : null;
$credits = isset($_GET['currency']) ? $_GET['currency'] : null;
$type = isset($_GET['type']) ? $_GET['type'] : null;
$refId = isset($_GET['ref']) ? $_GET['ref'] : null;
$signature = isset($_GET['sig']) ? $_GET['sig'] : null;
$result = false;
if (!empty($userId) && !empty($credits) && isset($type) && !empty($refId) && !empty($signature)) {
       $signatureParams = array(
               'uid' => $userId,
               'currency' => $credits,
               'type' => $type,
               'ref' => $refId
       );
       $signatureCalculated = generateSignature($signatureParams, SECRET);
       // check if IP is in whitelist and if signature matches
       if (in_array($_SERVER['REMOTE_ADDR'], $ipsWhitelist) && ($signature == $signatureCalculated)) {
               $result = true;

               if ($type == CREDIT_TYPE_CHARGEBACK) {

                       // Deduct credits from user
                       // This is optional, but we recommend this type of crediting to be implemented as well
                       // Note that currency amount sent for chargeback is negative, e.g. -5, so be caferul about the sign
                       // Don’t deduct negative number, otherwise user will get credits instead of losing them

               }
               else {

                       // Give credits to user

               }
       }
}
if ($result) {
       echo 'OK';
}
function generateSignature($params, $secret) {
       $str = '';
       foreach ($params as $k=>$v) {
               $str .= "$k=$v";
       }
       $str .= $secret;
       return md5($str);
}
Link to comment
Share on other sites

Looks fairly simple if you look at their API sample script.
<?phpdefine('SECRET', 'd9bee051cfe5613c6a2ddb513ad52fd9');
define('CREDIT_TYPE_CHARGEBACK', 2);


$ipsWhitelist = array(
       '174.36.92.186',
       '174.36.96.66',
       '174.36.92.187',
       '174.36.92.192',
       '174.37.14.28'
);
$userId = isset($_GET['uid']) ? $_GET['uid'] : null;
$credits = isset($_GET['currency']) ? $_GET['currency'] : null;
$type = isset($_GET['type']) ? $_GET['type'] : null;
$refId = isset($_GET['ref']) ? $_GET['ref'] : null;
$signature = isset($_GET['sig']) ? $_GET['sig'] : null;
$result = false;
if (!empty($userId) && !empty($credits) && isset($type) && !empty($refId) && !empty($signature)) {
       $signatureParams = array(
               'uid' => $userId,
               'currency' => $credits,
               'type' => $type,
               'ref' => $refId
       );
       $signatureCalculated = generateSignature($signatureParams, SECRET);
       // check if IP is in whitelist and if signature matches
       if (in_array($_SERVER['REMOTE_ADDR'], $ipsWhitelist) && ($signature == $signatureCalculated)) {
               $result = true;

               if ($type == CREDIT_TYPE_CHARGEBACK) {

                       // Deduct credits from user
                       // This is optional, but we recommend this type of crediting to be implemented as well
                       // Note that currency amount sent for chargeback is negative, e.g. -5, so be caferul about the sign
                       // Don’t deduct negative number, otherwise user will get credits instead of losing them

               }
               else {

                       // Give credits to user

               }
       }
}
if ($result) {
       echo 'OK';
}
function generateSignature($params, $secret) {
       $str = '';
       foreach ($params as $k=>$v) {
               $str .= "$k=$v";
       }
       $str .= $secret;
       return md5($str);
}

But who i do it ?

Link to comment
Share on other sites

who i do its will give the donator pack when i pay?

I doubt anyone around here is going to spoon feed you the exact script you'll need to make this function correctly. I suggest you read through all the documentation and links been given and attempt it yourself, people will more likely help when you get stuck rather then just creating it for you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...