amount becomes the total that leaves the sender, and the fees come out of it.
Use it for “send all”, for closing out an account, or for moving a user’s whole balance to a new address.
Request a gross quote
Read the sender’s current token balance, then pass it asamount with treat_as_gross_amount: true.
total_debit equals amount, so the address ends at exactly zero. Check that treat_as_gross_amount is true in the response before you ask the user to sign. It is left out of the response in net mode.
The fee here is illustrative. Tron fees are usually higher for a first-time sender, which needs the one-time approval, than for later transfers.
Edge cases
- The balance is too small. If
amountdoesn’t exceed the sponsorship fee plus any partner fee, the quote returns400 invalid_request. Don’t offer “send all” for dust balances. Hide it, or explain that the balance is below the minimum. - The balance changes before broadcast. If the address receives more tokens after the quote, the extra stays behind. If it sends tokens elsewhere first, the transfer fails with
insufficient_token_balance. Read the balance immediately before you quote. - With a partner fee. Both fees come out of
amount:recipient_amount=amount−fee−partner_fee.
Show the right number
In gross mode, the number the user typed or picked is what they pay, not what the recipient gets. Make your confirmation screen lead withrecipient_amount, so the recipient’s side is clear:
Send all 84.37 USDT. The recipient gets 83.27 USDT after a 1.10 USDT network fee.