Usage Examples
Generating a Payload
Section titled “Generating a Payload”Input Data
Section titled “Input Data”| Field | Value |
|---|---|
| Wallet | UQBJ6gU8gh_jRrzYDlfw9cpCwHaSn2mrK4O-1h8CDENehGYJ |
| Merchant | store123 |
| Amount | R$ 100.00 (= 10000 cents) |
| Currency | BRL |
| TX ID | tx123456 |
Step-by-Step Construction
Section titled “Step-by-Step Construction”1. Prefix: trp012. Field 01 (48): 0148UQBJ6gU8gh_jRrzYDlfw9cpCwHaSn2mrK4O-1h8CDENehGYJ3. Field 02 (08): 0208store1234. Field 03 (05): 0305100005. Field 04 (03): 0403BRL6. Field 05 (08): 0508tx1234567. CRC input: trp010148UQBJ6gU8...0508tx12345699048. Calculated CRC: A3F29. Field 99 (04): 9904A3F2Final Payload
Section titled “Final Payload”trp010148UQBJ6gU8gh_jRrzYDlfw9cpCwHaSn2mrK4O-1h8CDENehGYJ0208store1230305100000403BRL0508tx1234569904A3F2Generated Links
Section titled “Generated Links”From the payload, three types of links can be generated:
Universal Link
Section titled “Universal Link”https://trp.tonramp.io/{payload}Automatically detects the platform and redirects to Telegram or Web.
Telegram Deep Link
Section titled “Telegram Deep Link”https://t.me/TonRmpBot/tonramp?startapp={payload}Opens the TonRmpBot directly in Telegram.
Web Link (Miniapp)
Section titled “Web Link (Miniapp)”https://miniapp.tonramp.io?startapp={payload}Opens the checkout in a web browser.
Validating a Payload
Section titled “Validating a Payload”Python
Section titled “Python”from app.utils.trp import parse_trp_payload
payload = "trp010148UQBJ6gU8...9904A3F2"data = parse_trp_payload(payload)
if data["crc_valid"]: print(f"Merchant: {data['merchant']}") print(f"Amount: {data['amount']} cents") print(f"Currency: {data['currency']}")else: print("Invalid CRC!")TypeScript
Section titled “TypeScript”import { parseTrpPayload } from '@/lib/trp'
const data = parseTrpPayload(payload)
if (data.crc_valid) { console.log(`Merchant: ${data.merchant}`) console.log(`Amount: ${data.amount} cents`) console.log(`Currency: ${data.currency}`)} else { console.log('Invalid CRC!')}QR Code
Section titled “QR Code”QR Code data = https://trp.tonramp.io/{payload}Recommendations:
- Error correction level: M (15%)
- Minimum size: 200x200px
- White background, black code