• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Paypal

freddzor11

Member
Joined
May 25, 2009
Messages
695
Reaction score
5
Hey I use latest gesior, and I wonder how much of theese I should fill in, and what, there is no IPN in this gesior, what is instead of that?

Here is my paypal.php
Code:
<?php
if(!defined('INITIALIZED'))
    exit;

if($logged)
{
    require_once('./custom_scripts/paypal/config.php');
    echo '<h2>Automatic PayPal shop system</h2><br><b>Here are the steps you need to make:</b><br>
    1. You need a valid creditcard <b>or</b> a PayPal account with a required amount of money.<br>
    2. Choose how many points you want buy.<br />
    3. Click on the donate/buy button.<br>
    4. Make a transaction on PayPal.<br>
    5. After the transaction points will be automatically added to your account.<br>
    6. Go to Item shop and use your points.</b><br /><br />';

    echo '<style>
    table
    {
    border-collapse:collapse;
    }
    table, td, th
    {
    border:1px solid black;
    }
    </style>';

    echo '<table cellspacing="0" style="width:100%"><tr><td colspan="2"><b>Select offer:</b></td></tr>';
    foreach($paypals as $paypal)
    {
        echo '<tr><td>Buy ' . $paypal['premium_points'] . ' premium points for ' . $paypal['money_amount'] . ' ' . $paypal['money_currency'] . '</td><td style="text-align:center"><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
        <input type="hidden" name="cmd" value="' . $paypal_payment_type . '">
        <input type="hidden" name="business" value="' . $paypal['mail'] . '">
        <input type="hidden" name="item_name" value="' . htmlspecialchars($paypal['name']) . '">
        <input type="hidden" name="custom" value="' . $account_logged->getID() . '">
        <input type="hidden" name="amount" value="' . htmlspecialchars($paypal['money_amount']) . '">
        <input type="hidden" name="currency_code" value="' . htmlspecialchars($paypal['money_currency']) . '">
        <input type="hidden" name="no_note" value="0">
        <input type="hidden" name="no_shipping" value="1">
        <input type="hidden" name="notify_url" value="' . $paypal_report_url . '">
        <input type="hidden" name="return" value="' . $paypal_return_url . '">
        <input type="hidden" name="rm" value="0">
        <input type="image" src="' . $paypal_image . '" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
        </form></td></tr>';
    }
    echo '</table>';
}
else
    echo 'You are not logged in. Login first to buy points.';
 
if u use latest gesior 2012
u will find this in www/custom_scripts/paypal/config


PHP:
<?php
$paypal_report_url = 'http://yourdomain.com/paypal_report.php';
$paypal_return_url = 'http://yourdomain.com/?subtopic=shopsystem';
$paypal_image = 'https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif';
$paypal_payment_type = '_xclick'; // '_xclick' (Buy Now) or '_donations'

$paypals[0]['mail'] = 'your paypal login E-mail '; // your paypal login
$paypals[0]['name'] = '100 premium points on server Your server name  for 2 EURO';
$paypals[0]['money_amount'] = '2';
$paypals[0]['money_currency'] = 'EUR'; // USD, EUR, more codes: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_currency_codes
$paypals[0]['premium_points'] = 100;
 
if u use latest gesior 2012
u will find this in www/custom_scripts/paypal/config


PHP:
<?php
$paypal_report_url = 'http://yourdomain.com/paypal_report.php';
$paypal_return_url = 'http://yourdomain.com/?subtopic=shopsystem';
$paypal_image = 'https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif';
$paypal_payment_type = '_xclick'; // '_xclick' (Buy Now) or '_donations'

$paypals[0]['mail'] = 'your paypal login E-mail '; // your paypal login
$paypals[0]['name'] = '100 premium points on server Your server name  for 2 EURO';
$paypals[0]['money_amount'] = '2';
$paypals[0]['money_currency'] = 'EUR'; // USD, EUR, more codes: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_currency_codes
$paypals[0]['premium_points'] = 100;

That's the problem, everything is correct there but They dont recieve points, but i recieve their money. and when I enter http://Mydomain/paypal_report.php then it says
Code:
Wrong IP
?
 
Is there anything here I should change?
/pages/paypal_report.php
Code:
<?php
if(!defined('INITIALIZED'))
    exit;

require_once('./custom_scripts/paypal/config.php');
/*
 * PayPal IPN IPs (it can change in future)
 * https://ppmts.custhelp.com/app/answers/detail/a_id/92
 * search: notify.paypal.com (IPN delivery) 
*/
if(!in_array($_SERVER['REMOTE_ADDR'], array('173.0.81.1','173.0.81.33','66.211.170.66')))
{
    echo 'wrong IP';
    exit;
}
$receiverMail = $_REQUEST['receiver_email']; // ots admin mail
$status = $_REQUEST['payment_status']; // payment status, we add only when is 'Completed'
$currency = $_REQUEST['mc_currency']; // money currency, like USD or EUR
$gross = $_REQUEST['mc_gross']; // amount of money, like: 10.00
$payerMail = $_REQUEST['payer_email']; // player mail
$accountID = $_REQUEST['custom']; // user account ID
$transactionID = $_REQUEST['txn_id']; // transaction ID

$logFile = 'custom_scripts/paypal/reported_ids/' . $transactionID . '.log';
if(!file_exists($logFile) && $status == 'Completed')
{
    foreach($paypals as $pay)
    {
        if($receiverMail == $pay['mail'] && $currency == $pay['money_currency'] && $gross == $pay['money_amount'])
        {
            $account = new Account($accountID);
            if($account->isLoaded())
            {
                if(file_put_contents($logFile, 'accountID:' . $accountID . ',mail:' . $payerMail . ',amount:' . $gross . ' ' . $currency . ',points:' . $pay['premium_points']) !== false)
                {
                    $account->setPremiumPoints($account->getPremiumPoints() + $pay['premium_points']);
                    $account->save();
                }
            }
            break;
        }
    }
}
exit;
 
Back
Top