Binancecoin Tutorial to get BEP-20 token balance of an address

To query the balance of BEP-20 tokens, you need a valid Binancecoin address. With this tutorial you can easily query the balance of the respective Binancecoin address. We have written a detailed tutorial for this purpose. Read more.


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

The Code

$apikey = "YOURAPIKEY";
$binancecoinaddress = "BINANCECOINADDRESS"; // Binancecoin address you want to get the balance of
$contractaddress = "CONTRACTADDRESS"; // Smart contract address of the Token
# -------------------------------------------------------

# 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("binancecoinaddress" => $binancecoinaddress, "contractaddress" => $contractaddress) );
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 the Token balance to the screen
echo $resultdecoded["balance"];


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 the Binancecoin address you want to get the balance of.
  3. Replace “contractaddress” in line 5 of above code with the smart contract address of the Token

Final Steps

  1. Upload the code above to your local or remote machine
  2. Call the script by navigating to your favorite browser and entering the URL
  3. After a few seconds, the script will return a balance.

Congratulations! You just checked the Token balance of a Binancecoin address.

If you want to automatically receive notifications on deposits and withdrawals, please check out this tutorial about IPN for BEP-20 Token.