Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented first draft of usdt integration #161

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

ashthecoder05
Copy link

@ashthecoder05 ashthecoder05 commented Feb 21, 2024

USDT Payment Gateway Integration for WHMCS via Blockonomics

Description

Accept USDT (Tether) payments on your WHMCS website with ease. With this integration, payments are directly connected to your customers' MetaMask wallets, ensuring secure and straightforward transactions without intermediaries.

image

Key Features

  • Direct Wallet Connection: Enable USDT payments that directly interact with MetaMask, providing a seamless payment experience.
  • Security and Ownership: Payments are transferred directly into your own crypto wallet, mitigating common security risks associated with third-party intermediaries.
  • Easy Installation and Management: Quick setup process and straightforward management through your WHMCS admin panel.

Installation Guide

  1. Copy Integration Files: Transfer the modules folder to your root WHMCS directory.
  2. Activate Gateway: Navigate in your WHMCS admin to Setup -> Payments -> Payment Gateways, and activate Blockonomics as a payment option.
  3. **Configure Wallet Address:**Enter your USDT wallet address Blockonomics Merchants > Settings to ensure payment confirmations are received.
  4. **Ether Scan API Key:**Get the Ether scan API key from the etherscan website (https://docs.etherscan.io/getting-started/viewing-api-usage-statistics) follow the sets mentioned in the blog
  5. Network Type: Select the network test/production to test the payment gateway before making it public to the customer.
  6. Upgrade Instructions (Optional): For users upgrading from version 1.8.X to 1.9.X, execute upgrade.php found in modules/gateways/blockonomics/upgrade.php to remove unnecessary files and ensure your system is up-to-date.

Tags

USDT WHMCS Payment Gateway Crypto Payments Blockonomics MetaMask Secure Payments Cryptocurrency

modules/gateways/blockonomics/blockonomics.php Outdated Show resolved Hide resolved
modules/gateways/blockonomics/payment.php Outdated Show resolved Hide resolved
modules/gateways/blockonomics/assets/js/web3_checkout.js Outdated Show resolved Hide resolved
modules/gateways/blockonomics/assets/js/web3_checkout.js Outdated Show resolved Hide resolved
modules/gateways/blockonomics/blockonomics.php Outdated Show resolved Hide resolved
modules/gateways/blockonomics/blockonomics.php Outdated Show resolved Hide resolved
modules/gateways/blockonomics/blockonomics.php Outdated Show resolved Hide resolved
modules/gateways/blockonomics/blockonomics.php Outdated Show resolved Hide resolved
modules/gateways/blockonomics/blockonomics.php Outdated Show resolved Hide resolved
modules/gateways/blockonomics/payment.php Outdated Show resolved Hide resolved
modules/gateways/blockonomics/assets/js/web3_checkout.js Outdated Show resolved Hide resolved
modules/gateways/blockonomics/assets/js/web3_checkout.js Outdated Show resolved Hide resolved
modules/gateways/blockonomics/assets/js/web3_checkout.js Outdated Show resolved Hide resolved
modules/gateways/blockonomics/blockonomics.php Outdated Show resolved Hide resolved
modules/gateways/blockonomics/payment.php Outdated Show resolved Hide resolved
modules/gateways/blockonomics/payment.php Outdated Show resolved Hide resolved
modules/gateways/blockonomics/usdtblockonomics.php Outdated Show resolved Hide resolved
modules/gateways/blockonomics/pollTransactionStatus.php Outdated Show resolved Hide resolved
modules/gateways/blockonomics/usdtblockonomics.php Outdated Show resolved Hide resolved
Copy link
Collaborator

@DarrenWestwood DarrenWestwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall code and functionality is working well.

It will be a good idea to only start polling if USDT is enabled, to avoid unnecessarily starting the background process.

$path = __DIR__ . '/pollTransactionStatus.php';

// Command to check if the specific PHP script is running
$checkCommand = "pgrep -f 'php $path'";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I experience issues with this check. $output is set, but the script is not running in the background. I had to use the following in order for the script to start running correctly:

        // Command to check if the specific PHP script is running
        $output = [];
        $checkCommand = "pgrep -f 'php $path'";
        exec($checkCommand, $output, $return_var);

        $pid = (int)$output[0];
        $command = "ps -p $pid";
        $output = [];
        exec($command, $output);
        $isRunning = count($output) > 1;

        if (!$isRunning) {
            $startCommand = "php $path > /dev/null &";
            exec($startCommand, $startOutput, $startReturnVar);
        }

Please verify the commands that check if background polling is already running are correct and update accordingly.
Another working alternative:

        // Command to check if the specific PHP script is running
        $command = "ps aux | grep $path";
        $output = [];
        exec($command, $output);
        $isRunning = count($output) > 2;

        if (!$isRunning) {
            $startCommand = "php $path > /dev/null &";
            exec($startCommand, $startOutput, $startReturnVar);
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants