Syiko
Scripter/Developer
- Joined
- Aug 28, 2017
- Messages
- 474
- Solutions
- 3
- Reaction score
- 108
I am trying to install paygol but i got the euros and the player didn't get the points.. here is my scripts:
shoppaygol.php
paygol.php > ipn page.. :
is the problems with $points >>> should '".$points."' or change frmcurrency & frmprice to currency & price .
This is the tutorial of the notfication that the paygol gave out
I am not good at php
shoppaygol.php
Code:
<?php
if(!defined('INITIALIZED'))
exit;
if($logged)
{
echo '
<div id="cnt-box">
<div id="top"></div>
<div id="mid">
<div id="margins">
<style type="text/css">
.paygol_opt_menu {
outline:none;
-webkit-transition-duration:0.2s;
-moz-transition-duration:0.2s;
-o-transition-duration:0.2s;
transition-duration:0.2s;
display: block;
width: 100%;
height: 50px;
font-size: 15px;
background: #151c21;
color: #fff;
border: 1px solid #003a4a;
padding-left: 10px;
border-radius: 5px;
}
.paygol_opt_menu:hover {
background: #18252f;
-webkit-transition-duration:0s;
-moz-transition-duration:0s;
-o-transition-duration:0s;
transition-duration:0s;
}
</style>
<form name="pg_frm" method="post" action="https://www.paygol.com/pay">
<input type="hidden" name="pg_serviceid" value="xxxxx">
<input type="hidden" name="pg_currency" value="EUR">
<input type="hidden" name="pg_name" value="Roseman-war">
<p></p><h2> SELECT YOUR PRICE: </h2><p></p>
<select class="paygol_opt_menu" name="pg_price">
<option value="2">2€ - 1000 Premium Points</option>
<option value="4">4€ - 2100 Premium Points</option>
<option value="6">6€ - 3200 Premium Points</option>
<option value="8">8€ - 4500 Premium Points</option>
<option value="10">10€ - 7100 Premium Points</option>
</select><br><br>
<p></p><h2> CLICK TO BUY </h2><p></p>
<!--input name="pg_price" value="1"-->
<input type="hidden" name="pg_return_url" value="https://Roseman-war.tk/?subtopic=shopsystem">
<input type="hidden" name="pg_cancel_url" value="https://Roseman-war.tk/?subtopic=shopsystem">
<input type="image" name="pg_button" src="https://www.paygol.com/webapps/img/buttons/150/black_en_pbm.png" border="0" alt="Make payments with Paygol: the easiest way!" title="Make payments with Paygol: the easiest way!">
</form>
</div>
</div>
<div id="bot"></div>
<div id="copyrights" style="color: #efe;">
</div>
</div>';
}
else
echo 'You are not logged in. Login first to buy points.';
?>
Code:
<?php
/*
English:
This script will help you to integrate the PayGol payments platform on your Open Tibia server. Your users will be able to pay and get in-game points immediately and automatically, no need to wait hours or even days for manual delivery.
Before starting, you must create an account at https://secure.paygol.com/signup
For full technical documentation, visit https://devs.paygol.com/en
Steps:
1) Upload this file to your server, try to make it a hard to guess path.
2) Enter the full path to this file into the "IPN URL" field, at the "Notifications" section of your Paygol dashboard.
Example: http://www.yoursite.com/dtz7895/paygol.php
Español:
Este código te ayudará a integrar la plataforma de pagos PayGol en tu servidor Open Tibia. Tus usuarios podrán pagar y obtener sus puntos de inmediato y de forma automática, sin necesidad de esperar horas o hasta días por una entrega manual.
Antes de comenzar, debes crear una cuenta en https://secure.paygol.com/signup
Para ver documentacion técnica adicional visita https://devs.paygol.com/es
Pasos:
1) Sube este archivo a tu servidor, intenta que sea una ruta difícil de adivinar.
2) Ingresa la ruta completa de este archivo en el campo "URL de IPN", en la sección "Notificaciones" de tu panel de Paygol.
Ejemplo: http://www.yoursite.com/dtz7895/paygol.php
*/
// Secret Key of your Paygol account
$secret_key = "c4c94b3a-abaf-11ea-9e50-128b57940774";
// Secret key validation
if ($secret_key != $_GET['key']) {
echo "Validation error";
exit;
}
// Custom parameter
$custom = $_GET['custom'];
// Get price and currency. Price always has a decimal point and 2 decimals (e.g. 10.00 EUR, 9000.00 CLP).
$frmprice = $_GET['frmprice'];
$frmcurrency = $_GET['frmcurrency'];
// Get points based on the price and currency.
switch ($frmprice." ".$frmcurrency){
// Possible prices and their points. You can add as many as you want.
case "1.45 USD": $points = 1000; break;
case "4.00 EUR": $points = 2100; break;
case "6.00 EUR": $points = 3200; break;
case "8.00 EUR": $points = 4500; break;
case "10.00 EUR": $points = 7100; break;
// If the price doesn't match any of the options above, stop script.
default: echo "Price validation failed";
exit;
}
// Replace this information with your database details
$dbhost = "roseman-war.tk"; //Your database domain
$dbuser = "xxxx"; //Database username
$dbpassword = "xxxx"; //Database password
$db = "xxx"; //Database name
// Connect to database
$conn = mysqli_connect($dbhost, $dbuser, $dbpassword);
// Select database
mysqli_select_db($conn, $db);
// Update points
$sql = "UPDATE `accounts`
SET `premium_points` = `premium_points`+$points
WHERE `name` = '".mysqli_real_escape_string($conn, $custom)."'";
mysqli_query($conn, $sql);
// Close database connection
mysqli_close($conn);
?>
This is the tutorial of the notfication that the paygol gave out
Instant Payment Notification V2 (IPN) – Developers – Paygol
devs.paygol.com