Gesior Acc Paypal automatic script does not work.
Players pay but wont get points.
what should i use on $paypal_payment_type? xclick or _donations? and what is the difference?
C:\xampp\htdocs\custom_scripts\paypal\config.php
C:\xampp\htdocs\pages\paypal.php
C:\xampp\htdocs\pages\paypal_report.php
- - - Updated - - -
Nobody knows what is wrong?
Players pay but wont get points.
what should i use on $paypal_payment_type? xclick or _donations? and what is the difference?
C:\xampp\htdocs\custom_scripts\paypal\config.php
<?php
$paypal_report_url = 'http://narnia.sytes.net/paypal_report.php';
$paypal_return_url = 'http://narnia.sytes.net/?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
$paypals[0]['name'] = '1 premium points on server anderion.net for 0.01 EURO';
$paypals[0]['money_amount'] = '0.01';
$paypals[0]['money_currency'] = 'EUR'; // USD, EUR, more codes: https://cms.paypal.com/us/cgi-bin/?...t_ID=developer/e_howto_api_nvp_currency_codes
$paypals[0]['premium_points'] = 1;
C:\xampp\htdocs\pages\paypal.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.';
C:\xampp\htdocs\pages\paypal_report.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;
- - - Updated - - -
Nobody knows what is wrong?
Last edited: