• 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!

Solved [Paygol last update 4/08/2017] +Report made by them: It doesn't add the points to db

bury

Active Member
Joined
Jul 27, 2008
Messages
421
Solutions
7
Reaction score
25
I logged in today and I can't configure my service, I can't configure IPN and other info.

Have they closed their website? I could only withdraw my money and see a balance graphic.

------------------------------------ EDIT 25/08/2017 ------------------------------------ Admin, can this be moved to request? Thanks.

Hello, someone in paygol explained me about what happened. They've changed everything about payments. Now, services don't exists anymore, they will only give you a service_id, a secret key and a box in the config where you can fill your IPN URL. These three items are all what we have now to configure a payment. Now I'll paste the scripts I use for a normal donation in a open tibia server (all my info is edited).

paygol.php (you should link this url in buypoints.php if you have more than one payment).

PHP:
<b>SMS DONATION</b></CENTER><br /><br />
<ol>
    <li>Enter your account number.</li>
    <li>Choose your payment price.</li>
    <li>Click on the red Pay by mobile button.</li>
    <li>Follow the instructions.</li>
    <li>Your points will be added automatically.</li>
    <li><b>DONT FORGET TO PUT IN YOUR ACCOUNT NUMBER! IF YOU DONT DO IT YOU WONT GET ANY POINTS!</li></b>
</ol>
</br>
<center><b>
<li>X Premium Points for Y EUR</li>
<li>X Premium Points for Y EUR</li>
<li>X Premium Points for Y EUR</li>
</center></b>
</br>




<center><form name="pg_frm" method="post" action="https://www.paygol.com/pay" >
Enter account number:<p>
<input type="text" name="pg_custom" value=""><p>
   <input type="hidden" name="pg_serviceid" value="xxxx">
   <input type="hidden" name="pg_currency" value="EUR">
   <input type="hidden" name="pg_name" value="xxxxxxxxxxxx">
   <input type="radio" name="pg_price" value="x"checked>Buy xx premium points yyy<p>
   <input type="radio" name="pg_price" value="x">Buy xxx premium points yyy<p>
   <input type="radio" name="pg_price" value="x">Buy xxx premium points yyy<p>
   <input type="hidden" name="pg_return_url" value="http://xxxxxxx/?subtopic=shopsystem">
   <input type="hidden" name="pg_cancel_url" value="">
   <input type="image" name="pg_button" src="https://www.paygol.com/pay-now/images/payment-button.png" boder="0" alt="Make payments with PayGol: the easiest way!" title="Make payments with PayGol: the easiest way!">
</form> </center>

Now the report, you need to set it in the new notification page in paygol.

paygol_report.php

PHP:
<?php
$secret_key = "xxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxx";  // Enter secret key for your service.
// Secret key validation
if ($secret_key != $_GET['key']) {
    echo "Validation error";
    exit;
}
// get the variables from PayGol system
$transaction_id = $_GET['transaction_id'];
$service_id = $_GET['service_id'];
$shortcode = $_GET['shortcode'];
$keyword = $_GET['keyword'];
$message = $_GET['message'];
$sender = $_GET['sender'];
$operator = $_GET['operator'];
$country = $_GET['country'];
$custom = $_GET['custom'];
$points = $_GET['points'];
$price = $_GET['price'];
$currency = $_GET['currency'];
// Here you can do whatever you want with the variables, for instance inserting or updating data into your Database

//Replace these parameters by your database details

$dbhost     = "127.0.0.1"; //Your database domain
$dbuser     = "xxxxx"; //Database username
$dbpassword = "xxxxx"; //Database password
$db         = "xxxxxxx"; //Database name


try {
$SQL = new PDO('mysql:host=' . $dbhost . ';dbname=' . $db, $dbuser, $dbpassword);
        $SQL->query('UPDATE accounts SET premium_points = premium_points+' . intval($points) . ' WHERE `name` = ' . $SQL->quote($custom));
    } catch (PDOException $e) {
        print $e->getMessage();
        die();
    }
?>


These two scripts worked 100% in gesior 2012 and php 7 before paygol made his update. Where is the problem? As you can see in paygol.php the prices are not linked with any points, so obiously system doesn't add any points to your account.

Why it worked before?

Because in the service inside the paygol website you had the prices -> premium points configured, but now you can't set any of them because the only info we have is: secret key, service id and the IPN report.

So in this line:

<input type="radio" name="pg_price" value="x"checked>Buy xx premium points yyy<p>

I need to link the price (that is in value="x"), with points so the report ($points = $_GET['points'];) can understand it and add the points to db. Then, this script will be useful with gesior 2012, PHP 7 and the last update of Paygol.

Thanks.

-------------------------------------- EDIT 26/08/2017 -----------------------------------

Paygol answered me a ticket and they shared me a sourceforge that they did or someone did for them:

sourceforge.net/projects/paygol-open-tibia/files/

It's only the IPN (report) script. It has been made some days ago so I think it's compatible with Gesior 2012 last update and with PHP 7. It's explained in English and Spanish. The problem is that it doesn't add me the points, the rest is working 100% (reports, service_id and secret_key regconizes my account). Ill share without my credentials.

paygol_report.php:

PHP:
<?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  = "xxxxxx-xxxx-xxxx-xxxxxxxxxxxx";

// 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 "xx.00 EUR": $points = yy; break;
  case "xx.00 EUR": $points = yy; break;
  case "xx.00 EUR": $points = yy; 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     = "127.0.0.1"; //Your database domain
$dbuser     = "xxxxxx"; //Database username
$dbpassword = "xxxxxxxxxx"; //Database password
$db         = "xxxxxxxx"; //Database name

// Connect to database
$conn = mysql_connect($dbhost, $dbuser, $dbpassword);

// Select database
mysql_select_db($db);

// Update points
$sql = "UPDATE `accounts`
        SET    `premium_points` = `premium_points`+$points
        WHERE  `name`           = '".mysql_real_escape_string($custom)."'";
mysql_query($sql);

// Close database connection
mysql_close($conn);
?>


Now, my payment button script.

paygol.php:

PHP:
<b>SMS DONATION</b></CENTER><br /><br />
<ol>
    <li>Enter your account number.</li>
    <li>Choose your payment price.</li>
    <li>Click on the red Pay by mobile button.</li>
    <li>Follow the instructions.</li>
    <li>Your points will be added automatically.</li>
    <li><b>DONT FORGET TO PUT IN YOUR ACCOUNT NUMBER! IF YOU DONT DO IT YOU WONT GET ANY POINTS!</li></b>
</ol>
</br>
<center><b>
<li>xx Premium Points for yy EUR</li>
<li>xx Premium Points for yy EUR</li>
<li>xx Premium Points for yy EUR</li>
</center></b>
</br>




<center><form name="pg_frm" method="post" action="https://www.paygol.com/pay" >
Enter account number:<p>
<input type="text" name="pg_custom" value=""><p>
   <input type="hidden" name="pg_serviceid" value="xxxxxx">
   <input type="hidden" name="pg_currency" value="EUR">
   <input type="hidden" name="pg_name" value="xxxxxxxx">
   <input type="radio" name="pg_price" value="xx.00"checked>Buy yy premium points 3.00<p>
   <input type="radio" name="pg_price" value="yy.00">Buy xx premium points yy.00<p>
   <input type="radio" name="pg_price" value="yy.00">Buy xx premium points yy.00<p>
   <input type="hidden" name="pg_return_url" value="xxxxxxxxxxxxxx">
   <input type="hidden" name="pg_cancel_url" value="">
   <input type="image" name="pg_button" src="https://www.paygol.com/pay-now/images/payment-button.png" boder="0" alt="Make payments with PayGol: the easiest way!" title="Make payments with PayGol: the easiest way!">
</form> </center>


I dont know WHY it doesn't add the points. The db is well set because I even checked it in config.lua. In the ticket they told me instead of the numerical order in value="x", now you have to write the amount of money with two decimal numbers, for example value="10.00". I did it and it doesn't add the points.

My account is in test mode to test it, and all the reports are arriving without problem. I also write the custom part properly (acc name).

Where is the problem?

I opened a ticket yesterday and I dont know why my account has been removed, obiously they removed it. Also, my configured service is now disabled (tried it through my website). LOL. I dont know if they've closed or what, but why they didn't even answer the tickets?

B.U.M.P

New info about paygol last update in the OP.

B.U.M.P

OP updated, paygol provides me a new report script updated for their last update they've made in August where services and multi-prices (integrated in services) have been removed. Now, for multi-prices you need the report script they've shared with me, but, it doesn't add the points.

Thanks for your help.
 
Last edited by a moderator:
I have tried the new system and I like it.

Rewrite your script without using mysql_ if you are running newer versions of PHP that wont work (deprecated)
 
I have tried the new system and I like it.

Rewrite your script without using mysql_ if you are running newer versions of PHP that wont work (deprecated)

I don't know the code but tried this script with php 7 and worked fine with other server I had in Windows:


PHP:
try {
$SQL = new PDO('mysql:host=' . $dbhost . ';dbname=' . $db, $dbuser, $dbpassword);
        $SQL->query('UPDATE accounts SET premium_points = premium_points+' . intval($points) . ' WHERE `name` = ' . $SQL->quote($custom));
    } catch (PDOException $e) {
        print $e->getMessage();
        die();
    }

Now tried it with the new report script changing only the part of db script and didn't work. Can you share your payment button .php? Or take a look at mine and see if it's ok? I would appreciate.

Anyway idk how can they make a new script for open tibia with deprecated PHP... I think if someone try to open a server nowadays, he will try the newest version of PHP?
 
The process is the same as it was before, now you dont need a servide id for each price you want for your offers or you dont need to use a multi-price form; Now you can use something like this

HTML:
<form name="pg_frm" method="post" action="https://www.paygol.com/pay">
<input type="hidden" name="pg_serviceid" value="123">
<input type="hidden" name="pg_currency" value="EUR">
<input type="hidden" name="pg_name" value="DEMO">
<input type="hidden" name="pg_custom" value="">
<input type="hidden" name="pg_price" value="1">
<input type="hidden" name="pg_return_url" value="myot.com/return">
<input type="hidden" name="pg_cancel_url" value="myot.com/cancel">
<input type="submit" name="pg_button" value="Submit form">
</form>

You can use several forms for different prices or change the price (with javascript for example) as for IPN validation its the same, now you check for your private key instead of checking for remote address. I see nothing wrong in your code and I dont have any code on PHP sadly, try something like this

PHP:
$mbd = new PDO('mysql:host=localhost;dbname=DATABASE', $user, $password);
$myQuery = 'UPDATE accounts SET premium_points = premium_points + :points WHERE name = :name';
$params = array(':points' => $points, ':name' = > $custom);
$mbd->query($myQuery)->execute($params);
 
The process is the same as it was before, now you dont need a servide id for each price you want for your offers or you dont need to use a multi-price form; Now you can use something like this

HTML:
<form name="pg_frm" method="post" action="https://www.paygol.com/pay">
<input type="hidden" name="pg_serviceid" value="123">
<input type="hidden" name="pg_currency" value="EUR">
<input type="hidden" name="pg_name" value="DEMO">
<input type="hidden" name="pg_custom" value="">
<input type="hidden" name="pg_price" value="1">
<input type="hidden" name="pg_return_url" value="myot.com/return">
<input type="hidden" name="pg_cancel_url" value="myot.com/cancel">
<input type="submit" name="pg_button" value="Submit form">
</form>

You can use several forms for different prices or change the price (with javascript for example) as for IPN validation its the same, now you check for your private key instead of checking for remote address. I see nothing wrong in your code and I dont have any code on PHP sadly, try something like this

PHP:
$mbd = new PDO('mysql:host=localhost;dbname=DATABASE', $user, $password);
$myQuery = 'UPDATE accounts SET premium_points = premium_points + :points WHERE name = :name';
$params = array(':points' => $points, ':name' = > $custom);
$mbd->query($myQuery)->execute($params);

Thanks.

Does it work you with this?

<input type="hidden" name="pg_price" value="1">

Paygol told me that you have to put two decimal numbers ex: 1.00
 
Thanks.

Does it work you with this?

<input type="hidden" name="pg_price" value="1">

Paygol told me that you have to put two decimal numbers ex: 1.00
It does work for me. I cant try with decimal numbers right now, does that solve your issue?
 
It does work for me. I cant try with decimal numbers right now, does that solve your issue?

And in this part:

case "3.00 EUR": $points = 25; break;
case "5.00 EUR": $points = 50; break;
case "10.00 EUR": $points = 105; break;

Do you use decimal numbers?
 
And in this part:

case "3.00 EUR": $points = 25; break;
case "5.00 EUR": $points = 50; break;
case "10.00 EUR": $points = 105; break;

Do you use decimal numbers?
I am not using PHP and I am converting the points param to a integer so it doesnt really matter.
 
Back
Top