05 — Adoption

Integrate in under five minutes.

A step-by-step walk from creating your account to receiving your first payment webhook.

01

Create your account

Open @XthonPayBot and press Start. Your unique HD wallet is derived immediately.

02

Generate an API key

Inside the bot, open API Keys. Scope the key to read or withdraw. Add an IP whitelist for production.

03

Create an invoice

Call POST /v1/invoices. Show the returned deposit_address to your customer.

04

Handle the webhook

On payment, we POST invoice.paid to your callback_url. Credit the order and respond 200.

Authentication

All API requests require your API key in the X-API-Key header.

Python · base client
import requests

API_KEY = "xpay_live_your_key_id"
BASE    = "https://xthonpay.com/v1"

HEADERS = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

def api_get(path):
    return requests.get(BASE + path, headers=HEADERS).json()

def api_post(path, body):
    return requests.post(BASE + path, json=body, headers=HEADERS).json()

Creating an invoice

The invoice response includes a unique deposit_address. Show it to your customer — when they send USDT to it, we detect the payment automatically.

Python · create invoice
# Create a 50 USDT invoice
resp = api_post("/invoices", {
    "amount": "50.00",
    "external_id": "order_12345",
    "callback_url": "https://yourapp.com/webhooks/pay",
})

deposit_address = resp["data"]["deposit_address"]
print(f"Customer should send to: {deposit_address}")

Handling webhooks

On payment we POST to your callback_url. Respond HTTP 200 to acknowledge. If we don't receive 200, we retry up to 3 times with escalating delay (5s, 10s, 15s).

Python · Flask webhook
from flask import Flask, request

app = Flask(__name__)

@app.route("/webhooks/pay", methods=["POST"])
def handle_webhook():
    event = request.json
    if event["event"] == "invoice.paid":
        order_id = event["data"]["external_id"]
        amount   = event["data"]["amount_received"]
        fulfill_order(order_id, amount)
    return "OK", 200
Make your webhook handler idempotent. Retries may deliver the same event more than once — use invoice_id to deduplicate.

Requesting a withdrawal

Send USDT from your wallet to any BSC address. No service fees — you only pay on-chain gas.

Python
resp = api_post("/withdraw", {
    "amount": "100.00",
    "to_address": "0x71C765…62b",
})
print(f"Withdrawal {resp['id']}: {resp['status']}")

Best practices

  • Store API keys securely. Environment variables, never source control.
  • Use unique external_ids. One per order. Makes reconciliation trivial.
  • Enable IP whitelisting on production keys.
  • Make webhooks idempotent. Dedupe by invoice_id.
  • Poll as fallback. If you miss a webhook, GET /v1/invoices/{id} is authoritative.

Start building now.

Open the bot, get your API key, make your first request.

Open Telegram Bot API Reference