A customer clicks "I've paid", your order page turns green, and someone packs the box. If the only proof is the customer's word or a screenshot, you can ship goods for a payment that never happened, landed on the wrong network, or was a token that only looks like USDT.

This post is the check we'd run before marking an order paid, with code for USDT on Tron and on Ethereum. The same idea works for any coin.

What "paid" should mean

An order is paid when all of these are true:

  1. A transaction exists on the chain you expect.
  2. It succeeded.
  3. It moved the real token, identified by its contract address, not by its name.
  4. It paid the address you gave this order.
  5. The amount is at least what you asked for.
  6. It has enough confirmations for the amount.
  7. You haven't already counted it for another order.

Point 7 is the one people forget. Store the transaction id against the order and refuse to use it twice.

A unique deposit address per order makes points 4 and 7 much easier. If every customer pays the same address, you end up matching on amount and time, and two customers paying the same price ten seconds apart becomes a support ticket.

USDT on Tron (TRC-20)

TronGrid lists TRC-20 transfers into an address. Filter by the USDT contract and only confirmed transfers:

const USDT_TRON = "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"; async function findTronPayment(depositAddress, expectedUnits, seenTxIds) { const url = new URL(`https://api.trongrid.io/v1/accounts/${depositAddress}/transactions/trc20`); url.searchParams.set("only_to", "true"); url.searchParams.set("only_confirmed", "true"); url.searchParams.set("contract_address", USDT_TRON); url.searchParams.set("limit", "50"); const res = await fetch(url); const { data } = await res.json(); return data.find((t) => t.type === "Transfer" && t.to === depositAddress && t.token_info.address === USDT_TRON && BigInt(t.value) >= expectedUnits && !seenTxIds.has(t.transaction_id) ); } // USDT has 6 decimals on Tron: 25 USDT = 25_000_000 units 

Keep amounts as integers in the token's smallest unit. Floats and money don't mix.

USDT on Ethereum (ERC-20)

On EVM chains, read the receipt and decode the Transfer event yourself. With ethers v6:

import { ethers } from "ethers"; const USDT_ETH = "0xdAC17F958D2ee523a2206206994597C13D831ec7"; const iface = new ethers.Interface([ "event Transfer(address indexed from, address indexed to, uint256 value)", ]); async function checkEthPayment(provider, txHash, depositAddress, expectedUnits, minConfirmations) { const receipt = await provider.getTransactionReceipt(txHash); if (!receipt || receipt.status !== 1) return { ok: false, reason: "not found or failed" }; const latest = await provider.getBlockNumber(); const confirmations = latest - receipt.blockNumber + 1; if (confirmations < minConfirmations) return { ok: false, reason: "waiting for confirmations" }; for (const log of receipt.logs) { if (log.address.toLowerCase() !== USDT_ETH.toLowerCase()) continue; const parsed = iface.parseLog(log); if (parsed?.name !== "Transfer") continue; if (parsed.args.to.toLowerCase() !== depositAddress.toLowerCase()) continue; if (parsed.args.value >= expectedUnits) return { ok: true, confirmations }; } return { ok: false, reason: "no matching USDT transfer" }; } 

Two details matter here. The check on log.address is what stops a fake token named "USDT" from passing. And the status check matters because a failed transaction still has a hash and still shows up in a wallet's history.

How many confirmations?

There's no single right number. It depends on the chain and on how much you lose if a payment disappears. Pick a number per network, write it down, and use a higher one for large orders.

Things the code above doesn't cover

  • Underpayments. Decide in advance whether 99% of the price counts, and what happens to the rest.
  • Late payments, sent after your quote expired.
  • Wrong network: USDT sent on Ethereum to an address you only watch on Tron.
  • Refunds, which on-chain are a new payment from you, not a reversal.

Or let a gateway do the watching

We build Plaxswap, a crypto payment gateway, and this check is the core of what it does. Each payment gets a one-time address on the network the customer picks. We wait for that network's confirmations and run our payment checks, including sanctions and wallet screening, then your server gets a signed webhook. A payment counts as paid if the customer sent at least 99.5% of the amount, and coins that arrive up to 24 hours late still reach you, marked late. Your customer covers the 1.5% checkout fee and there's no monthly fee.

If you want that instead of running your own watcher, the merchant page explains the gateway and its plugins for WooCommerce, WHMCS, XenForo and FOSSBilling, and the step-by-step guide to accepting crypto payments covers setup. Either way, ship on what the chain says, not on what the customer says.