Providing an API key enables transaction visibility in the TON Pay Merchant Dashboard, webhook notifications, and wallet management features.
Function signature
Transfer parameters
API options
Target blockchain network. Use
"mainnet" for production or "testnet" for development and testing.The TON Pay API key from the Merchant Dashboard. When provided, it enables:
- Transaction visibility in the TON Pay Merchant Dashboard.
- Webhook notifications for completed transactions.
- Receiving wallet management from the Merchant Dashboard.
Parameter details
Human-readable payment amount. Decimals are allowed, for example, 10.5 TON.
Asset to transfer. Use “TON” for Toncoin or a jetton master address or constant, for example, USDT.
Mainnet address riskToken constants such as
USDT always reference mainnet jetton master addresses and are not affected by the chain option. Using them on testnet may send transactions to mainnet contracts.For testnet, explicitly pass the correct testnet jetton master address instead of using token constants.Payee wallet address. Optional if an API key is provided. Defaults to the merchant’s default wallet address configured in the Merchant Dashboard.
Payer wallet address. In UI flows, obtain it from TON Connect.
Jetton only. Numeric identifier embedded into the jetton payload for idempotency and tracking. Ignored for Toncoin payments.
Short note visible to the user in the wallet while signing.
Comments are on-chain and publicly visible in blockchain explorers. Do not include confidential data. Keep comments under 120 characters to avoid increased gas fees.
Note visible to the recipient after the transfer is received.
Comments are on-chain and publicly visible in blockchain explorers. Do not include confidential data. Keep comments under 120 characters to avoid increased gas fees.
Predefined asset constants
Built-in constants can be used instead of raw addresses.Mainnet address riskIn
asset, token constants such as USDT always reference mainnet jetton master addresses and are not affected by the chain option. Using them on testnet may send transactions to mainnet contracts.For testnet, explicitly pass the correct testnet jetton master address instead of using token constants.Response fields
Prebuilt TON Connect transaction message. Intended to be passed to
sendTransaction as messages: [message].Base64 hash of the signed message body content (payload). Used with
getTonPayTransferByBodyHash.Tracking reference string. Used with
getTonPayTransferByReference.API key configuration
The TON Pay API key is optional in development and recommended for production. When configured, it enables transaction tracking, webhook notifications, and centralized wallet management in the TON Pay Merchant Dashboard.Obtain an API key
Open the Merchant Dashboard
Open the TON Pay Merchant Dashboard and sign in to the merchant account.
Usage in code
API key capabilities
| Capability | With API key | Without API key |
|---|---|---|
| Transaction visibility and monitoring | Transfers appear in the TON Pay Merchant Dashboard with status tracking and full transaction history. | Transfers are processed on-chain but are not visible in the Merchant dashboard. |
| Webhook notifications | Real-time HTTP POST notifications are sent for completed and failed payments. | No webhook notifications; payment status must be obtained through the manual polling. |
| Receiving wallet management | Receiving wallets are managed from the TON Pay Merchant Dashboard; addresses can be updated without code changes. | Receiving wallet addresses must be hard-coded in the application. |
recipientAddr handling | Optional; when omitted, the merchant’s default wallet from the Merchant Dashboard is used automatically. | Required for every transfer. |
recipientAddr is optional.
recipientAddr is required.
Testnet configuration
Funds at riskRunning tests on mainnet can result in irreversible loss of real TON. Always use
chain: "testnet" and testnet wallet addresses during development. Verify the network before switching to mainnet.Set up testnet
Use testnet wallet addresses
Ensure all wallet addresses are valid testnet addresses.
Obtain testnet TON
- Use testnet wallet account: Tonkeeper or other TON wallets.
- Get testnet TON from a faucet to test transactions.
Configure environment
Use environment variables to switch between mainnet and testnet:Verify testnet transactions
Verify testnet transactions using testnet block explorers:Apply testing best practices
- Test all payment outcomes on testnet, including success, failures, user rejections, and edge cases.
- Verify webhook endpoint correctly processes testnet webhooks; payload structure matches mainnet.
- Validate behavior across different amounts, including small, large, and fractional values.
- Ensure
referenceandbodyBase64Hashare persisted and usable for status lookups. - Exercise error paths such as insufficient balance, invalid addresses, and network issues.