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 instantly get a key like sp_live_.... 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 your wallet address.

STEP 3

Buyer pays

Show the amount + address. The buyer sends USDT (TRC20) — money goes straight to your wallet, we never hold it.

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",
          "customer_ref": "user123",
          "webhook_url": "https://my.site/hook"},
    headers={"X-API-Key": KEY})
order = r.json()
print("Show buyer:", order["pay_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","customer_ref":"user123","webhook_url":"https://my.site/hook"}'

# → {"order_id":"abc123","pay_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", webhook_url: "https://my.site/hook" })
});
const order = await res.json();
console.log("Show buyer:", order.pay_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);

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","status":"paid","amount","tx_id","customer_ref"}. We retry up to 5 times if your server doesn't answer 200.

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, no webhook; the order stays "created" and expires after 24h, the money sits on your wallet. Contact support and we will match it manually by tx_id.

How do I refund a payment?

Money goes directly to your wallet — you own it. To refund, just send USDT back from your wallet. We are not involved in funds at all.

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. On Pro you get multiple keys — one per project.

What if I exceed my plan limit?

The API returns 402 Payment Required with a message. Upgrade in the subscription page — the key activates instantly after 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.