Skip to main content

Integration: Coupon Payments

Prerequisites

  1. 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.
  2. Use the Transatron node for all TRON operations (not just /broadcasttransaction).

  3. Secure the ADMIN key. Never expose it in client apps or front-end code.


Flow: Sending Transactions with Coupon Payments

  1. Wallet: Call /triggersmartcontract to estimate resources.
  2. Wallet: Read tx_fee_rtrx_account / tx_fee_rusdt_account from the transatron JSON object in the response.
  3. Wallet → Server: Send the fee estimate (and user identifiers) to your backend.
  4. 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.
  5. Transatron: Deducts the coupon limit from the company account and issues the coupon.
  6. Server → Wallet: Return the coupon code to the wallet.
  7. Wallet: Inject the coupon into the signed user transaction and broadcast to /broadcasttransaction.
  8. 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.
  9. 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

  1. Example flows: Transatron TronWeb Examples (GitHub)
  2. Detailed description of Coupon API: Coupon API
  3. Guide: Preparing and Broadcasting Transactions
  4. API reference: Extended RPC Calls