Hi, the title says it all. Players donate but wont get points
Here are the scripts;
Custom_scripts/paypal/config
Paypal.php
Main directory paypal_report.php
Pages/Paypal_report.php
Here are the scripts;
Custom_scripts/paypal/config
PHP:
<?php
$paypal_report_url = 'http://lightonia.servegame.com/?subtopic=paypal_report';
$paypal_return_url = 'http://lightonia.servegame.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'] = '[email protected]'; // your paypal login
$paypals[0]['name'] = '300 points for 5 Euro (+20% bonus)';
$paypals[0]['money_amount'] = '5';
$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'] = 300;
$paypals[1]['mail'] = '[email protected]'; // your paypal login
$paypals[1]['name'] = '670 points for 10 Euro (+34% bonus)';
$paypals[1]['money_amount'] = '10';
$paypals[1]['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[1]['premium_points'] = 670;
$paypals[2]['mail'] = '[email protected]'; // your paypal login
$paypals[2]['name'] = '1020 points for 15 Euro (+36% bonus)';
$paypals[2]['money_amount'] = '15';
$paypals[2]['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[2]['premium_points'] = 1020;
$paypals[3]['mail'] = '[email protected]'; // your paypal login
$paypals[3]['name'] = '1400 points for 20 Euro (+40% bonus)';
$paypals[3]['money_amount'] = '20';
$paypals[3]['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[3]['premium_points'] = 1400;
$paypals[4]['mail'] = '[email protected]'; // your paypal login
$paypals[4]['name'] = '1775 points for 25 Euro (+42% bonus)';
$paypals[4]['money_amount'] = '25';
$paypals[4]['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[4]['premium_points'] = 1775;
$paypals[5]['mail'] = '[email protected]'; // your paypal login
$paypals[5]['name'] = '2145 points for 30 Euro (+43% bonus) - Best Deal';
$paypals[5]['money_amount'] = '30';
$paypals[5]['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[5]['premium_points'] = 2145;
Paypal.php
PHP:
<?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.';
PHP:
<?php
$_GET['subtopic'] = 'paypal_report';
$_REQUEST['subtopic'] = 'paypal_report';
include('index.php');
Pages/Paypal_report.php
PHP:
<?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;