This PHP script enables the integration of tegro.money's payment gateway for purchasing TGR tokens in Telegram bots. It's designed for easy implementation into any PHP-based Telegram bot management script.
The TGR purchase script is a PHP-based solution that facilitates the buying of TGR tokens using fiat or cryptocurrency through the tegro.money payment gateway. This script is designed to be seamlessly integrated into any PHP script managing Telegram bots.
- PHP 7.0 or higher
Download the files from the repository and open them in your code editor.
-
Fill in the details at the beginning of the
tobot.php
file:######################## $tegromoney_shopid = "YourShopID"; // Shop ID on tegro.money $tegromoney_secretkey = "YourSecretKey"; // Secret key of the shop on tegro.money $minlimit = 150000; // Minimum TGR purchase limit $maxlimit = 850000; // Maximum TGR purchase limit ########################
-
Enter the API TOKEN of your bot at the beginning of the
postback.php
file:################### define('TOKEN', 'YourBotApiToken'); ###################
-
Fill in the MySQL database connection details in the
global.php
file:$hostName = "YourHostName"; $userName = "YourUserName"; $password = "YourPassword"; $databaseName = "YourDatabaseName";
-
In the shop settings on tegro.money, set the "Notification URL" to point to your
postback.php
file. For example:https://yourdomain/bot/postback.php
-
If necessary, create the required tables in your MySQL database:
CREATE TABLE paylinks (...); CREATE TABLE users (...);
-
Optionally, fill in the body of functions:
function getTGRrate() { ... } function saveTransaction($sum, $asset, $network, $type, $address) { ... }
-
Include the
tobot.php
file in the main code of your bot management script usinginclude
. -
In the appropriate part of your code, call the function
buyTGRProcessSum($data);
. When properly set up, this function will display a message to the user with a button to purchase TGR.
This project is distributed under the MIT License. See LICENSE for more information.
- Lana Cool - Developer - Lana Cool