Integration: Coupon Payments
Prerequisites
-
Request a Company account.
Contact info@transatron.io or Telegram Support.
You will receive:- A Company account address (used for balance checks and top-ups — see Accounts and Balances).
- Two API keys:
- ADMIN key → creates coupons and spends funds from the company account.
- USER key → used by wallets; cannot spend funds; only identifies partner wallet traffic.
-
Use the Transatron node for all TRON operations (not just
/broadcasttransaction
). -
Secure the ADMIN key. Never expose it in client apps or front-end code.
Flow: Sending Transactions with Coupon Payments
- Wallet: Call
/triggersmartcontract
to estimate resources. - Wallet: Read
tx_fee_rtrx_account
/tx_fee_rusdt_account
from thetransatron
JSON object in the response. - Wallet → Server: Send the fee estimate (and user identifiers) to your backend.
- Server: Use the ADMIN API key to create a coupon with a TRX/USDT limit.
- Optionally, set a slightly higher limit to avoid underfunding.
- Unused funds are automatically refunded to the company account.
- Transatron: Deducts the coupon limit from the company account and issues the coupon.
- Server → Wallet: Return the coupon code to the wallet.
- Wallet: Inject the coupon into the signed user transaction and broadcast to
/broadcasttransaction
. - Transatron:
- Covers the transaction with resources.
- Refunds any unspent coupon balance to the company account.
- Example: Coupon = 15 TRX, transaction costs 10 TRX → 5 TRX refunded.
- Wallet: Receive the user transaction hash and monitor confirmations.
Handling Errors
-
Insufficient coupon balance
- If the coupon’s TRX/USDT limit is too low, Transatron rejects the transaction.
- Fix: re-estimate resources and issue a new coupon.
-
Expired coupon
- Coupons are time-limited. If expired, the transaction will not be processed or broadcast.
warning
Always validate that coupon has enough TFU (former RTRX) to cover transaction and have not expired before broadcasting a transaction.
What if the User Wants to Burn TRX?
Simply prepare, sign, and broadcast the transaction as usual via Transatron.
- No coupon is applied.
- The transaction is forwarded to TRON unchanged.
- Fees are paid by burning TRX (or using staked resources).
Additional Information
- Example flows: Transatron TronWeb Examples (GitHub)
- Detailed description of Coupon API: Coupon API
- Guide: Preparing and Broadcasting Transactions
- API reference: Extended RPC Calls