Checkout
Checkout flow
Section titled “Checkout flow”- Your backend generates a TRP payload with the payment data (in USDT)
- The payload is sent to the frontend as a universal link
- The buyer scans the QR code or clicks the link
- The checkout page detects the platform:
- Telegram User-Agent → redirects to the bot
- Preference cookie → redirects accordingly
- No preference → renders page with buttons (Telegram / Web)
- The buyer confirms the amount and signs the USDT transfer via TonConnect
- The merchant receives USDT in the wallet specified in the payload
- Your system queries the status via API
Generating the checkout
Section titled “Generating the checkout”Via Web Generator
Section titled “Via Web Generator”Visit trp.tonramp.io and fill in:
- Destination TON wallet
- Merchant ID
- Payment amount in USDT
- Transaction ID (optional, auto-generated)
Via API
Section titled “Via API”curl -X POST https://api.tonramp.io/api/v1/wallet/trp/generate \ -H "Content-Type: application/json" \ -d '{ "wallet": "UQBJ6gU8gh_jRrzYDlfw9cpCwHaSn2mrK4O-1h8CDENehGYJ", "merchant": "store123", "amount": "100.00", "currency": "USDT", "tx_id": "tx123456" }'Via code (client-side)
Section titled “Via code (client-side)”import { generateTrpPayload } from '@/utils/trp'
const payload = generateTrpPayload( 'UQBJ6gU8gh_jRrzYDlfw9cpCwHaSn2mrK4O-1h8CDENehGYJ', 'store123', '100.00', 'USDT', 'tx123456')
const checkoutUrl = `https://trp.tonramp.io/trp/${payload}`Checkout page
Section titled “Checkout page”The checkout page at trp.tonramp.io/trp/\{payload\} displays:
- TonRamp logo
- Merchant name
- Amount formatted in USDT
- QR code with the universal link
- “Pay via Telegram” button
- “Pay via Browser” button
- Payment status (polling every 5 seconds)
Querying status
Section titled “Querying status”After the buyer clicks the link, you can query the status:
curl https://api.tonramp.io/api/v1/trp/status/{tx_id}Response:
{ "status": "pending", "amount": "10000", "currency": "USDT", "updated_at": "2025-03-05T12:00:00Z"}Possible statuses: pending, paid, completed, expired.
Quote API
Section titled “Quote API”Before confirming the payment, the mini app fetches a quote to get the final amount (with fee) and balance:
curl -H "Authorization: Bearer {token}" \ https://api.tonramp.io/api/v1/trp/quote/{payload}Response:
{ "merchant": "store123", "wallet_dest": "UQBJ6gU8gh_...", "amount_usdt": 100.00, "fee_usdt": 1.0, "total_required_usdt": 101.00, "user_balance_usdt": 120.0, "has_sufficient_balance": true, "tx_id": "tx123456", "quote_id": "abc123", "quote_ttl_seconds": 120}Each TRP payment charges:
- Fixed fee: max(1 USDT, 1% of the charged amount)
- TON gas: a small on-chain cost of a few millicents of TON, paid by the buyer from their wallet
Example for a 100 USDT charge:
- Amount to the merchant: 100.00 USDT
- TonRamp fee: 1.00 USDT
- Total debited from the buyer: 101.00 USDT
Payment flow in the mini app
Section titled “Payment flow in the mini app”When the buyer clicks “Pay via Telegram” or “Pay via Browser”:
- The mini app reads
start_paramfrom Telegram WebApp (or?startapp=in the URL) - If the parameter starts with
trp01, it redirects to the confirmation screen - The screen calls
GET /api/v1/trp/quote/{payload}to get amount, fee, total, and balance - Displays: merchant, USDT amount, fee, total, buyer balance
- If insufficient balance: “Top up with PIX” button (top-up flow being built out)
- If sufficient balance: “Confirm payment” button generates the TonConnect transaction
- The buyer signs the transfer in their wallet
- USDT is transferred: amount to the merchant + fee to the TonRamp hot wallet, atomic in a single signature