Integration Guide — 5 minutes to your first payment

Everything you need to accept USDT (TRC20) in your bot or website. Copy-paste the examples — they work as-is.

Try it live in Swagger

How it works in 4 steps

STEP 1

Get your API key

Subscribe on the pricing page — you get a key like sp_live_... (free plan at once, a paid plan within a minute after we detect the payment). It identifies you and counts your plan limit.

STEP 2

Create an order

Call POST /v1/orders. You receive a unique amount (9.57, 9.84…) and the TRC20 address for that order.

STEP 3

Buyer pays

Show the amount + address. The buyer sends USDT (TRC20) — we detect the match and fire your webhook.

STEP 4

Webhook → deliver

We detect the payment in ~30 sec and send a webhook with tx_id. Your code delivers the key, file or access.

Copy-paste code

Pick your language. Both examples do the same: create an order and poll it.

# pip install requests
import requests, time

API = "https://pay.cleantrade.info"
KEY = "sp_live_YOUR_KEY"

# 1. create an order
r = requests.post(f"{API}/v1/orders",
    json={"product_id": "indicator.zip",
          "wallet": "TUoZyqzdCB85SWSYQpBPyKVRi1TbpejWfD",  # your TRC20 wallet,
          "customer_ref": "user123",
          "webhook_url": "https://my.site/hook"},
    headers={"X-API-Key": KEY})
order = r.json()
print("Show buyer:", order["amount"], "USDT to", order["wallet"])

# 2. wait for payment (or just wait for the webhook)
while True:
    st = requests.get(f"{API}/v1/orders/{order['order_id']}",
                      headers={"X-API-Key": KEY}).json()
    if st["status"] == "paid":
        print("Paid!", st["tx_id"])
        # deliver the goods here
        break
    time.sleep(5)
# 1. create an order
curl -X POST https://pay.cleantrade.info/v1/orders \
  -H "X-API-Key: sp_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"product_id":"indicator.zip","wallet":"TUoZyqzdCB85SWSYQpBPyKVRi1TbpejWfD","customer_ref":"user123","webhook_url":"https://my.site/hook"}'

# → {"order_id":"abc123","amount":9.57,"wallet":"T...","status":"created"}

# 2. check status
curl https://pay.cleantrade.info/v1/orders/abc123 \
  -H "X-API-Key: sp_live_YOUR_KEY"

# → {"status":"paid","tx_id":"6b3a..."}
// for websites: vanilla fetch
const API = "https://pay.cleantrade.info";

// 1. create an order
const res = await fetch(API + "/v1/orders", {
  method: "POST",
  headers: { "X-API-Key": "sp_live_YOUR_KEY", "Content-Type": "application/json" },
  body: JSON.stringify({ product_id: "indicator.zip", wallet: "TUoZyqzdCB85SWSYQpBPyKVRi1TbpejWfD", webhook_url: "https://my.site/hook" })
});
const order = await res.json();
console.log("Show buyer:", order.amount, order.wallet);

// 2. poll until paid
const t = setInterval(async () => {
  const st = await (await fetch(API + `/v1/orders/${order.order_id}`,
    { headers: { "X-API-Key": "sp_live_YOUR_KEY" } })).json();
  if (st.status === "paid") { clearInterval(t); console.log("Paid!", st.tx_id); }
}, 5000);
wallet is required: pass your own TRC20 address in every order. Amounts are unique within that wallet, so two merchants can use the same amount.

Webhook receiver (auto-delivery)

The simplest way: we call YOUR url when the payment arrives. Here is a ready-made receiver for Python (aiohttp):

# pip install aiohttp   → run: python webhook.py
from aiohttp import web

async def hook(request):
    data = await request.json()
    if data["status"] == "paid":
        print("ORDER PAID:", data["order_id"], data["tx_id"])
        # ← deliver the goods here (file, key, access)
    return web.Response(text="ok")

app = web.Application()
app.router.add_post("/hook", hook)
web.run_app(app, port=8081)
Webhook payload: {"order_id","product_id","status":"paid","amount","wallet","tx_id","paid_at","customer_ref"}. We retry up to 5 times if your server doesn't answer 200.
Every delivery is signed: headers X-CleanTrade-Timestamp and X-CleanTrade-Signature (HMAC-SHA256 of timestamp + "." + raw request body, prefix sha256=). Your signing secret is personal to your account: it arrives in Telegram together with the API key and is also returned by GET /v1/subscribers/me. Verify the signature and the freshness of the timestamp before you deliver goods.

FAQ

What if the buyer sends a different amount?

Amounts are matched to 2 decimals: 19.889 counts as 19.89. USDT on TRC20 stores 6 decimals, so a small tail (19.889 vs 19.89) is normal and still matches. If the amount really differs (e.g. 19.88 vs 19.89) — no match and no webhook: the order stays created and expires in 24 hours. The money has already reached your wallet, so settling it with the buyer is up to you.

How do I refund a payment?

The money goes straight to the wallet you passed in the order — we never hold it, so a refund is yours to make: send it back from the same wallet in your own transfer. There is nothing to request from us.

Why TRC20 only?

USDT on Tron has the lowest fees (~1$) and is the standard for bot/indicator sales. Other networks can be added later.

Is my API key safe?

Keep it server-side. Never put it in frontend code.

What if I exceed my plan limit?

The API returns 402 Payment Required with a message. Upgrade in the subscription page — the key activates within a minute after we detect the payment.

How do I contact support?

Telegram: @CleanTradeSupport_bot — we usually reply within a few hours. Mention your order_id or API key and we will help.

A buyer says he paid, but I got no webhook. What now?

Open the order. If it is still "created", no matching transfer has been seen yet — the buyer may have sent a different amount, on another network, or after the order expired. The rule is public: we credit an order when an incoming USDT TRC20 transfer of exactly the order amount reaches the wallet named in that order after it was created and before it expired. Anyone can verify it on Tronscan with the wallet from the order — the blockchain is the record. Send us the order_id and we will give you the check log for it: the time window, how many times we scanned the wallet, and what we saw.