• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Adding Points to Account w/ PayPal

Ward_214

Pro PvP
Joined
Dec 11, 2008
Messages
297
Reaction score
0
When players donate through PayPal I get the money in my account smoothly. But as the title says, the players don't get the points automatically. I have to add the points manually from the shop admin on website.

Can someone please help me with this.. I would greatly appreciate it.
Here are my files:

PayPal.html
Code:
<b>PayPal Shop System.</b><br><br>
The shop costs:<ul><li> 5 USD (for 5 points)</li><li> 10 USD (for 15 points)</li><li> 20 USD (for 25 points)</li><br>

<b>Here are the steps you need to make:</b> <br>
1. A PayPal account with a required balance [5, 10 or 20 USD] or a creditcard. <br>
2. Fill in your account number. <br>
3. Click on the Buy Now button or your creditcard brand. <br>
4. Make a transaction. <br>
5. After the transaction 5, 15, or 25 points will be automatically added to your account. <br>
6. Go to Item shop and use your points <br> <br> <br> </b>

<span style="color:red">If you recall the money and your premium points can't be recalled, your account will be deleted</span>

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="@yahoo.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Premium points">
<b>Account name/login:</b> <input type="text"  name="custom" value="">

<select name="amount">
  <option value="5.00">5 USD</option>
  <option value="10.00">10 USD</option>
  <option value="20.00">20 USD</option>
</select>
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="notify_url" value="http://server.no-ip.org/paypal/ipn/ipn.php">
<input type="hidden" name="return" value="http://server.no-ip.org/">
<input type="hidden" name="rm" value="0">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

PayPal.php
Code:
<?PHP
$content = file_get_contents("paypal.htm");
if($content != FALSE)
	$main_content .= $content;
else
	$main_content .= 'Can not load file <b>paypal.htm</b> or file is empty.';
?>

IPN.php
Code:
<?php    
    if(gethostbyaddr($_SERVER['REMOTE_ADDR']) != 'notify.paypal.com')
    { 
        exit();
    }
    if($_REQUEST['debug'])
    {
        ini_set('display_errors', true);
        error_reporting(E_ALL);
    }
    // MySQLi connection
    $mysql = new mysqli('localhost', 'root', 'password', 'database');
    // Variables, don't touch!
	$payer_email = $_REQUEST['payer_email']; 
    $receiverEmail = $_REQUEST['receiver_email'];
    $paymentStatus = $_REQUEST['payment_status'];
    $mcGross = $_REQUEST['mc_gross'];
    $mcCurrency = $_REQUEST['mc_currency'];
    $customValue = stripslashes(ucwords(strtolower(trim($_REQUEST['custom']))));  
    // Prices
    $prices = array('5.00' => 5, '10.00' => 15, '20.00' => 25);
    // Setup
    $receiver = '@yahoo.com';
    $currency = 'USD';
    $whatToDo = 1; // 1 - delete, 2 - custom
    
    if($paymentStatus == 'Completed' && $receiverEmail == $receiver && isset($prices[$mcGross]) && $mcCurrency == $currency)
    {
		$accountId = $mysql->query('SELECT id, premium_points FROM accounts WHERE accounts.name = '.$customValue.'');
        $mysql->query('UPDATE `accounts` SET `premium_points` = `premium_points`' . $prices[$mc_gross] . ' WHERE `name` = '.$customValue.'');
		$mysql->query('INSERT INTO `z_shop_points_bought` (`id`, `amount`, `type`, `accountid`, `code`, `paypalmail`, `date`) VALUES (NULL , '.$prices[$mc_gross].', Paypal, '.$accountId['id'].', '.$mc_gross.', '.$payer_email.', CURRENT_TIMESTAMP);');
	}
    elseif($paymentStatus == 'Reversed' && $receiverEmail == $receiver)
    {
        if($whatToDo == 1)
        {
            $mysql->query('DELETE FROM `accounts` WHERE `name` = "' . $customValue . '"');
        }
        elseif($whatToDo == 2)
        {
            // if not deleting, what to do?
        }
    }
    else
    {
        exit();
    }
?>

Is there anymore files needed?
 
I just erased my email. I know I needed to put that there.
I do have IPN enabled on my paypal.
I'm kinda thinking its something to do with the array thing (drop down box) in the paypal.html

I dont see anywhere in these scripts that actually says "set premium points to account". And I'm a noob at that kind of stuff.
 
Back
Top