Binancecoin tutorial to subscribe BEP-20 token deposits of an address

This tutorial will show you how to receive automated messages when you receive money on the selected Binancecoin address. The only thing needed is a Binancecoin address where the money will land and a URL where the notification will be sent.


  1. Basic knowledge of PHP
  2. Account at
  3. A local or remote machine with PHP7 and installed modules JSON and CURL

IPN receiver

  1. Create a folder with a secure name on your web server. For example B5tN-KtfOTf37 (Please use something own).
  2. Upload the following PHP code in the new generated folder on your web server.
  3. Create a file named ipnlog.txt and upload it to the same folder and give the file write permissions. The script below will log all deposits to the ipnlog.txt file. You can process deposits the way you want of course (Example: Update user balances, Mark orders as paid, …).
    // Receive JSON
    $request = file_get_contents("php://input");

    // Decode JSON
    $request = json_decode($request, true);

    // Log parameters to a file
    file_put_contents("ipnlog.txt", "id:" . $request["id"] . " action:" . $request["action"] . " timestamp:" . $request["timestamp"] . " type:" . $request["type"] . " binancecoinaddress:" . $request["binancecoinaddress"] . " contractaddress:" . $request["contractaddress"] . " amount:" . $request["amount"] . "\r\n", FILE_APPEND);

    // Tell API that the IPN has been received successfully. This is very important! Otherwise you will receive notifications 10 times for every deposit.
    header("Content-Type: application/json");
    $response = ["ok" => true];
    $response = json_encode($response);
    echo $response;


The Code

$apikey = "YOURAPIKEY"; // API Key in your account panel
$contractaddress = "CONTRACTADDRESS"; // Contract address of the token you want to watch
$binancecoinaddress = "BINANCECOINADDRESS"; // Binancecoin address you want to watch
$url = ""; // URL where you want to receive updates
# -------------------------------------------------------

# Define function endpoint
$ch = curl_init("");

# Setup request to send json via POST. This is where all parameters should be entered.
$payload = json_encode( array("contractaddress" => $contractaddress, "binancecoinaddress" => $binancecoinaddress, "url": $url) );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $payload );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array("Content-Type:application/json", "Authorization: " . $apikey));

# Return response instead of printing.
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );

# Send request.
$result = curl_exec($ch);

# Decode the received JSON string
$resultdecoded = json_decode($result, true);

# Print status of request (should be true if it worked)
echo $resultdecoded["ok"];


Code Modifications

  1. Replace “YOURAPIKEY” in line 3 of above code with the API Key in your Account Panel.
  2. Replace “ethereumaddress” in line 4 of above code with Contract address of the token you want to watch.
  3. Replace “contractaddress” in line 5 of above code with the Binancecoin address you want to watch.
  4. Replace “” in line 6 of above code with the URL you want to receive updates.

Final Steps

  1. Upload the code above to your local or remote machine
  2. Call the script in your browser. For example, if you upload it to the root directory of your website, you can call it by typing
  3. After a few seconds, the script will return a status showing if the request was successful.

Congratulations! You just created an address subscription and will receive notifications on future deposits to the provided url.

If you want to create an Binancecoin address you can use to send BEP-20 Tokens from, check out this tutorial about create Binancecoin adresses.