How to Accept USDT TRC20 Payments on Your Website
Wallet address, self-hosted scanner or hosted gateway: what each really costs you, and a full walkthrough of integrating a USDT payment gateway from first API call to launch.
Most merchants who want to accept USDT payments on their website start the same way: they paste a wallet address on the checkout page and hope for the best. That works for the first ten orders. After that, matching transfers to orders by hand becomes the job nobody wants.
This guide covers the three realistic setups and what each costs you in time and risk. Then it walks through a full hosted-gateway integration, from the first API call to going live.
Three ways to accept USDT payments on your website
1. Show a wallet address and check manually
You put your TRC20 address and a QR code on the payment page. The customer sends USDT, then emails you a screenshot or a transaction hash. You look it up on a block explorer and mark the order paid.
It costs nothing and you hold your own keys. The problems show up with volume:
- Two customers who both owe 50 USDT and pay in the same hour look identical on chain. You end up chasing transaction hashes.
- People pay from exchanges, and many type the amount before the withdrawal fee is taken. You receive 49 instead of 50, and now you have a support ticket.
- Someone sends USDT on the wrong network, or sends a token that is merely named "USDT". If you only check the token name, you can be fooled.
- Nothing happens at 3 a.m. Digital goods wait until you wake up.
Fine for a side project with a handful of orders a week. Not much beyond that.
2. Run your own scanner
You generate addresses, watch the chain for incoming transfers, and match them to orders in your database. On TRON that means reading TRC20 Transfer events for your addresses and checking that the contract is the real USDT contract (TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t, as listed on Tether's site).
You keep custody and pay no third party. But you now own:
- Confirmation logic. A transaction in a block isn't final until that block is solidified, which the TRON developer docs say typically takes about a minute. Credit earlier and, in rare cases, a fork can undo it.
- Matching. Either one address per order, which means sweeping funds out of hundreds of addresses later (each TRC20 sweep needs TRX for energy, see TRC20 USDT transaction fees explained), or a shared address with unique amounts.
- Key security. A server holding private keys is a target.
- Node reliability. When your RPC provider rate-limits you, payments look missing.
Worth it if you have engineering time and a real reason to hold your own keys. Most shops underestimate the maintenance.
3. Use a hosted USDT payment gateway
A gateway gives you an API and a hosted checkout page. Your server creates a payment, sends the customer to checkout, and gets a webhook when the money arrives. Watching the chain, matching amounts and handling expiry become the gateway's problem. If the idea is new to you, what is a crypto payment gateway covers the basics. No developer? Many gateways also let you create payment links straight from the dashboard.
The catch: most hosted gateways are custodial. Payments land in addresses the gateway manages, get credited to your balance, and you withdraw when you want. You're trusting the operator between payment and payout, so withdraw regularly and don't treat a gateway balance as a savings account.
| Manual address | Self-hosted scanner | Hosted gateway | |
|---|---|---|---|
| Setup time | Minutes | Weeks | An afternoon |
| Who holds funds | You | You | Gateway, until you withdraw |
| Order matching | By hand | Your code | Automatic |
| Late or wrong amounts | Support tickets | Your code | Gateway rules + manual review |
| Ongoing work | Every single order | Servers, keys, nodes | One webhook endpoint |
Pick the network first: TRC20, ERC20 or BEP20
Before writing code, decide which USDT you accept. TRC20 is the usual default for payments, mostly because almost every exchange and wallet supports it and a lot of customers already hold their USDT there.
Fees are harder to rank than people think. Each network prices them differently: TRON charges in energy and bandwidth (paid in TRX if you don't have enough), Ethereum in gas, BNB Chain in BNB gas. And what your customer actually pays usually comes down to their exchange's withdrawal fee for that network, which changes often. USDT TRC20 vs ERC20 vs BEP20 goes through the differences in detail.
On TillCrypto, USDT-TRC20 and TRX are live today; USDT on Ethereum and BNB Chain is coming soon.
Whatever you choose, say it plainly on the checkout page. "Pay with USDT" on its own invites wrong-network transfers.
Integrating a USDT payment gateway step by step
The flow below uses TillCrypto as the worked example, but the shape is the same with most gateways: create, redirect, wait for a webhook.
Step 1: get an API key and set your webhook
Sign up and create a secret key on the dashboard's Developers page. Test keys start with sk_test_, live keys with sk_live_. On the same page, set your webhook URL and copy the webhook secret (it starts with whsec_).
Keep the key and the secret in environment variables on your server. Neither should ever end up in browser JavaScript.
Step 2: create a payment from your server
When the customer clicks "Pay with USDT", your backend creates a payment:
const res = await fetch('https://api.tillcrypto.com/v1/payments', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.TILLCRYPTO_SECRET_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
amount: '25.00',
currency: 'USDT-TRC20',
order_id: 'ORDER-10042',
description: 'Pro plan, 1 month',
success_url: 'https://example.com/thanks',
cancel_url: 'https://example.com/cart',
}),
});
const payment = await res.json();
// payment.id, payment.status === 'pending', payment.checkout_urlSave payment.id on your order. Pass your own order number as order_id; it comes back in the webhook, which makes the lookup trivial.
Step 3: redirect to checkout
Send the customer to checkout_url. The hosted page shows a QR code, the address, the exact amount and a 60-minute countdown, and it updates on its own once the transfer is confirmed. Impatient customers can hit "I've paid, check now".
Step 4: fulfill on the webhook, not the redirect
This is where most first integrations go wrong. A customer landing on your success_url proves nothing, because anyone can type that URL. Fulfill the order only after a payment.paid webhook with a valid signature.
Each webhook carries an X-TillCrypto-Signature header shaped like t=<unix time>,v1=<hex>, where v1 is an HMAC-SHA256 of <t>.<raw body> keyed with your webhook secret. Verify it against the raw bytes, before any JSON parsing. In Express, that means express.raw() on this one route:
import express from 'express';
import { createHmac, timingSafeEqual } from 'node:crypto';
function isValid(rawBody, header, secret) {
if (!header) return false;
const { t, v1 } = Object.fromEntries(header.split(',').map((p) => p.split('=')));
const expected = createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex');
const a = Buffer.from(v1 ?? '', 'hex');
const b = Buffer.from(expected, 'hex');
if (a.length !== b.length) return false;
const fresh = Math.abs(Date.now() / 1000 - Number(t)) < 300;
return fresh && timingSafeEqual(a, b);
}
const app = express();
app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
const rawBody = req.body.toString('utf8');
const header = req.get('X-TillCrypto-Signature');
if (!isValid(rawBody, header, process.env.TILLCRYPTO_WEBHOOK_SECRET)) {
return res.status(400).send('invalid signature');
}
const event = JSON.parse(rawBody);
if (event.type === 'payment.paid' && event.livemode) {
// find the order by event.data.order_id, mark it paid if it isn't already
}
res.sendStatus(200);
});Note the livemode check. Test events and live events go to the same URL with the same secret, so a correctly signed test event can look exactly like a real one. In production, only fulfill when type is payment.paid and livemode is true, and ignore event types you don't recognize (the dashboard's test button, for example, sends webhook.test).
Then make the handler idempotent. Failed deliveries are retried at 1m, 5m, 15m, 1h, 6h and 24h, so the same event can arrive twice. Skip duplicates using X-TillCrypto-Event-Id or the payment ID, and return a 2xx quickly. How to verify crypto payment webhooks goes deeper, including the usual mistakes.
Step 5: test without real money
With an sk_test_ key everything works the same, but nothing touches the chain or your balance. Open a test payment's checkout and simulate it as paid. Your success page and webhook endpoint should behave exactly as they will in production, except the event arrives with livemode: false. The dashboard also has a button that sends a test event, which is handy while you debug signature code.
Step 6: go live
Swap your sk_test_ key for an sk_live_ key. The webhook URL and secret stay the same; test and live events both arrive there, so tell them apart by the livemode field.
Create one small real payment and pay it yourself from an exchange or wallet. Watch it move from pending to paid and confirm your order updated. Then request a small payout to check the withdrawal side. It has to be more than the 2 USDT network fee, and payouts are reviewed before they're sent, so don't expect it to be instant. On TillCrypto there's no processing fee; a TRC20 USDT payout costs that fixed 2 USDT.
What still needs a human
No setup removes every edge case. Customers will underpay, overpay, send TRX instead of USDT, or pay a day late. A decent gateway records these as unmatched transfers for review, but you still need a policy: refund, ask for the difference, or credit by hand. Write it down before the first one lands. Crypto payment edge cases walks through the common ones.
Pre-launch checklist
- The checkout page names coin and network, e.g. "USDT on TRON (TRC20)".
- Secret keys and the webhook secret live in server environment variables, never in frontend code or Git.
- A webhook URL is set, and you've received at least one event on it.
- Orders are fulfilled only from a verified
payment.paidwebhook withlivemode: true. - Signature checks use the raw body and a constant-time comparison.
- The webhook handler ignores duplicate events and unknown event types.
- Orders aren't cancelled until
payment.expiredarrives. - You've run the full flow in test mode, webhook included.
- You've made one real payment and one real payout.
- There's a written policy for underpayments, overpayments and wrong-coin transfers, and someone looks at unmatched transfers at least once a day.