T

BuyTron

Swap USDT → TRX

API availablelast check 0s ago
Developer API

Integrate USDT to TRX exchange into your app

Use the BuyTron API to create exchange quotes, submit signed USDT transactions, track exchange status, and resolve referral codes.

Base URL

https://api.buytron.org/api

Auth

No API key required

Format

JSON requests and responses

Recommended flow

  1. 1. Create an exchange. Send the user TRON address and USDT amount to receive quote, service address, fee, and expiry.
  2. 2. Sign USDT transfer client-side. Keep private keys in the user wallet. Your app submits only the signed transaction object.
  3. 3. Submit the signed transaction. BuyTron broadcasts the transaction, handles energy, and sends TRX to the user.
  4. 4. Poll status. Read the exchange until it reaches completed, failed, or expired.
  5. 5. Reconcile a broadcast transaction. If submission fails after the USDT transaction was broadcast, submit its hash once the exchange status is failed.

Create quote

curl -X POST https://api.buytron.org/api/exchange/create \
  -H "Content-Type: application/json" \
  -d '{
    "userAddress": "TXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "usdtAmount": 25
  }'

Submit signed transaction

curl -X POST https://api.buytron.org/api/exchange/submit-signed-transaction \
  -H "Content-Type: application/json" \
  -d '{
    "exchange_id": "exchange_123",
    "user_address": "TXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "signedTransaction": { "...": "TronWeb signed transaction object" },
    "expected_amount": 25
  }'

Check status

curl "https://api.buytron.org/api/exchange/exchange_123?userAddress=TXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

Core Exchange API

POST/exchange/create

Create wallet exchange

Creates an exchange quote for a connected wallet flow.

  • usdtAmount includes the service fee and must be between 5 and 10000.
  • referrerAddress is optional; new attribution is applied only after wallet ownership is proven by the payment.

Request

{
  "userAddress": "TXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "usdtAmount": 25,
  "referrerAddress": "TYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"
}

Response

{
  "success": true,
  "exchange_id": "exchange_...",
  "user_address": "TXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "usdt_amount": 25,
  "trx_amount": 67.2,
  "exchange_rate": 0.372,
  "service_address": "T...",
  "service_fee": 3.5,
  "status": "created",
  "expires_at": "2026-05-28T12:00:00.000Z"
}
GET/exchange/{id}/unsigned-transaction?userAddress={address}

Prepare the USDT transaction

Builds an unsigned mainnet transfer for the stored exchange quote. Sign this exact transaction in the user wallet.

  • Only an unexpired automatic quote in created status can be prepared.
  • The transaction memo binds the signature to buytron:{exchange_id}. An unbound transaction is rejected.
  • Validate the sender, USDT contract, recipient and amount before asking the wallet to sign. Do not broadcast from the client.

Response

{
  "success": true,
  "transaction": { "txID": "...", "raw_data": { "...": "..." }, "raw_data_hex": "..." }
}
POST/exchange/submit-signed-transaction

Submit signed USDT transaction

Submits a user-signed USDT transaction, delegates energy if needed, broadcasts it, and sends TRX to the user.

  • Keep the exchange ID if the response is lost. Check that same exchange before creating another payment.
  • A TRX transaction hash is final only when GET exchange reports completed.

Request

{
  "exchange_id": "exchange_...",
  "user_address": "TXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "signedTransaction": { "...": "TronWeb signed transaction object" },
  "expected_amount": 25
}

Response

{
  "success": true,
  "transaction_id": "usdt_tx_hash",
  "trx_txid": "trx_tx_hash",
  "trx_amount": 67.2,
  "energy_delegated": true,
  "activation_sent": false,
  "bandwidth_sent": false
}
GET/exchange/{id}?userAddress={address}

Get exchange status

Returns the current status and public details for an exchange.

Response

{
  "success": true,
  "exchange": {
    "id": "exchange_...",
    "user_address": "TXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "usdt_amount": 25,
    "trx_amount": 67.2,
    "status": "completed",
    "mode": "automatic",
    "trx_tx_hash": "trx_tx_hash"
  }
}
POST/exchange/reconcile

Recover a failed exchange

Resumes a failed automatic exchange when its signed USDT transaction was already broadcast and confirmed.

  • Use this only after submit-signed-transaction returned an error and the exchange status is failed.
  • The transaction sender, recipient, exact USDT amount, timestamp, confirmation, and prior use are verified on-chain.
  • Repeated calls for a completed exchange never send TRX again.
  • Only one automatic recovery payout is attempted. Ambiguous payout states require support review.

Request

{
  "exchange_id": "exchange_...",
  "user_address": "TXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "transaction_hash": "64-character TRON transaction hash"
}

Response

{
  "success": true,
  "transaction_id": "usdt_tx_hash",
  "trx_txid": "trx_tx_hash",
  "trx_amount": 67.2,
  "reconciled": true,
  "already_completed": false
}

Referral API

POST/wallet-auth/challenge

Request a wallet ownership challenge

Returns a short-lived message. Sign the literal message with TRON signMessageV2 or the wallet adapter signMessage method.

Request

{"wallet_address":"TXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}

Response

{"success":true,"challenge_id":"...","message":"...","expires_at":"..."}
POST/wallet-auth/verify

Verify wallet ownership

Consumes the challenge and returns a token for this wallet. Use Authorization: Bearer {access_token} for referral mutations.

  • Tokens expire after 30 minutes. Clear the token when the wallet changes or disconnects. Never submit a private key.

Request

{"challenge_id":"...","signature":"..."}

Response

{"success":true,"access_token":"...","wallet_address":"T...","expires_at":"..."}
POST/referral/code?walletAddress={address}

Create or get referral code

Creates a code for a wallet or returns the existing one.

  • Requires a Bearer token proving ownership of walletAddress.

Response

{
  "success": true,
  "code": "mycode123",
  "wallet_address": "TXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "created_at": "2026-05-28T12:00:00.000Z"
}
GET/referral/resolve?referrer={codeOrAddress}

Resolve referrer

Resolves a referral code or address into a wallet address.

Response

{
  "success": true,
  "wallet_address": "TXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "input": "mycode123"
}
GET/referral/stats?referrerAddress={address}

Get referral stats

Returns referral profit and user counts for a referrer.

Response

{
  "success": true,
  "total_profit": 12.6,
  "withdrawn_profit": 4,
  "available_profit": 8.6,
  "total_referrals": 10,
  "level1_referrals": 8,
  "level2_referrals": 2
}
PUT/referral/code

Update referral code

Updates a wallet referral code. Codes must be 8-16 lowercase alphanumeric chars.

  • Requires a Bearer token proving ownership of walletAddress.

Request

{
  "walletAddress": "TXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "newCode": "partner123"
}

Response

{
  "success": true,
  "code": "partner123",
  "wallet_address": "TXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}

Integration notes

All TRON addresses must use the base58 format and start with T. Exchange amounts are in USDT, and timestamps are Unix milliseconds unless an ISO string is returned.

User private keys must never be sent to BuyTron. Build wallet integrations so users sign transactions locally with TronLink, WalletConnect, Trust Wallet, OKX, or another supported wallet.