Integration: Instant Payments
Prerequisites
- Register using TransatronBot and get your RPC URL and API Key. Don't forget to top-up your account.
- Use the Transatron node for all TRON operations.
Not just/broadcasttransaction, but also resource estimation and monitoring.
Flow: Sending Transactions with Instant Payments
-
Estimate resources
Call/triggersmartcontractto estimate resources required for the user’s transaction. -
Parse Transatron response
In the JSON response, Transatron adds atransatronobject with fee data:tx_fee_rtrx_instant→ TRX fee requiredtx_fee_rusdt_instant→ USDT fee required
-
Create payment transaction
- Prepare a TRX or USDT payment transaction to the Transatron payment address.
- The amount must equal the required fee (
tx_fee_rtrx_instantortx_fee_rusdt_instant). - Sign it with the wallet’s private key.
-
Prepare the user transaction
- Construct and sign the transaction the user actually wants to broadcast.
-
Broadcast transactions sequentially
- First send the payment transaction.
- Wait until Transatron acknowledges it.
- Then send the user transaction.
-
Monitor
- Receive the transaction hash.
- Track confirmations as usual.
tip
Instant payments work with both TRX and USDT, but TRX is cheaper and recommended by default.
Handling Errors
-
Underpriced payment
- If the payment transaction does not cover the required fee, Transatron returns
INSTANT_PAYMENT_UNDERPRICED. - The user transaction is not broadcasted.
- Fix: re-estimate with
/triggersmartcontract, re-create the payment transaction, and try again.
- If the payment transaction does not cover the required fee, Transatron returns
-
Payment transaction failure
- If the payment transaction itself fails, Transatron does not broadcast the user transaction.
- Error returned:
NOT_ENOUGH_FUNDS(with message).
What if the User Doesn’t Want to Use Instant Payment?
You can simply prepare, sign, and broadcast the transaction via Transatron without an instant payment.
- Transatron will bypass fee coverage.
- The transaction is forwarded to TRON as-is.
- Fees will be charged directly by TRON (either by burning TRX or using staked resources).
How to Get TRX If a User Only Has USDT?
Transatron provides an instant USDT → TRX swap service:
- Send a USDT transfer from the user’s address to:
TTTgXpHNbw8UcNa8N2weZtqCuhxJFuqSD5 - TRX is returned to the same address.
Constraints:
- Minimum amount: 3 USDT
- Fees:
- 2 USDT fixed (to cover the USDT transfer itself)
- +1% service fee
- Exchange rate: taken from the SunSwap V2 pool.
Additional Information
- Example flows: Transatron TronWeb Examples (GitHub)
- Guide: Preparing and Broadcasting Transactions
- API reference: Extended RPC Calls