Integrate USDT BEP20 Automatic Payments In a Laravel Application

May 04, 2024

Table Of Contents


This guide will direct you on how to integrate USDT BEP20 Automatic Payments in your Laravel website, allowing you to start accepting USDT Automatic Payments over the Binance Smart Chain (BSC) directly to your wallet without having to rely on any third part payment gateway.

Hierarchical Deterministic Wallets (HD) Wallets

This PHP script leverages the power of Hierarchical Deterministic Wallets (HD) Wallets to generate addresses that serve the purpose of receiving the payments within your application.

With HD Wallets, all the payment addresses are generated from on single mnemonic phrase and that is all you need to start accepting USDT BEP20 payments.


This guide assumes you are actively engaged in developing a Laravel application with user authentication and are keen to integrate USDT BEP payments, enabling seamless acceptance of USDT payments from your user base.

Additionally, it is assumed that you possess a Crypto wallet of your choice that gives you access to your wallet's Mnemonic Phrase. The wallet address should always hold enough BNB to cater for transfer fees and in this case each transaction consumes 0.0004 BNB

Familiarity with the Laravel PHP framework is also presumed for a smoother understanding of the integration process.

It is also important to note that this scripts is developed in Laravel 11 and in case of any compatibility issue with your project Laravel version, feel free to contact me via telegram @lakescripts or via email

You should make sure to have the php-bcmath extension installed on your server

With that said, let's dive in and get started with integrating USDT BEP20 Automatic Payments in your Laravel project so that you can start accepting USDT payments over the Binance Smart Chain (BSC) Network.

Step 1: Install required Packages

To begin, you'll need to install the required PHP packages with Composer as shown below.

          composer require bitwasp/bitcoin

          composer require kornrunner/keccak

          composer require simplito/elliptic-php

         composer require sop/asn1

         composer require sop/crypto-encoding

         composer require sop/crypto-types

         composer require web3p/ethereum-tx

Step 2: Configuration

As you already have your Laravel project in place, it's time to manage the configuration by adding the necessary models, controllers, and other essential files to the project.

Begin by downloading and extracting the USDT BEP20 Automatic Payments With HD Wallets for Laravel zipped file. The file structure is outlined below:

file structure

Now, proceed to copy the files into your Laravel application, following the designated file structure.

For certain files (routes/console.php, app/Models/User.php, routes/web.php), simply copy the specified lines of code into the corresponding files in your Laravel application.

Copy files

To begin, copy the scheduler commands to your Laravel project.


Copy the controller into your project.


Copy the Utils folder and along with the contained files


Copy the models to your project.


Copy the migration file into your migrations folder.


Copy the js folder along with its contained javascript files.


Also copy the amount.blade.php and pay.blade.php files along with their directory to your views folder


Copy and paste code


Copy the following code into your console.php file.

use Illuminate\Support\Facades\Schedule;



The cron job

To facilitate payment processing and maintain constant interaction with the BSC blockchain, the system employs a cron job/task scheduling to execute the scheduled commands mentioned above. For comprehensive guidance on managing Laravel task scheduling and cron jobs, refer to the Laravel documentation at Laravel Scheduling

For testing purposes, initiate the schedules by executing the following Artisan command.

          php artisan schedule:run

Alternatively, you can directly execute the commands using the Artisan commands below for the 'check-usdt-payments', and 'move-funds' command.

          Php artisan app:check-usdt-payments
          Php artisan app:move-funds


Copy the following code into your User Model.

          public function usdtPayments(){
        return $this->hasMany(UsdtPayment::class);
    public function getTotalUsdtPayments(){
        return $this->usdtPayments()->where('status', '=', 'success')->sum('amount');


Copy the following code to your routes/web.php file

])->group(function () {
    Route::get('/usdt-payment', [
    Route::post('/usdt-payment', [
    Route::get('/pay-usdt', [
    Route::get('/check_status', [


Run the migrations.

Now, proceed to execute the migrations to update and generate the necessary tables in the database.

During this process, new tables will be generated, specifically the 'bep_addresses' and 'usdt_payments' table."

Execute the migrations by running the following artisan command below.

          php artisan migrate


Add the MNEMONIC_PHRASE, BEP_NODE_URI and the BEP_NETWORK in your .env file. The mnemonic phrase is a 12 word phrase the for your wallet and from it, all the payment addresses will be generated including the central wallet which will be the address at index zero.

You will also need to set the BEP_USER and BEP_PASSWORD in case you are using a BSC node with authentication.


Step 3: Testing and Running

With everything set up, it's time to proceed to test the payments.

Now, log in as a user and visit /usdt-payment. You should encounter a straightforward page prompting you to enter the desired payment amount before proceeding.

Feel free to customize the user interface and flow to align with the specific requirements of your application.



Next, you will be redirected to a page displaying the payment address and QR code.


After making the payment to the displayed wallet address, execute the following Artisan commands to process the payment by interacting with the BSC blockchain in the development environment

          Php artisan app:check-usdt-payments
          Php artisan app:move-funds

After sending the funds to the specified address, You should receive a successful alert indicating that the payment was processed successfully.

With all configurations in place, the funds should be seamlessly transferred to your central wallet.

With that said, you should now be equipped to proceed and make the final adjustments in accordance with your specific application requirements.

Thanks and Best Wishes