TON Connect manifest
Before installing and setting up the TON Pay SDK, the application must provide a TON Connect manifest, which is a JSON file that defines application metadata. Wallets use this manifest to discover the application.First payment
Install necessary libraries
- React
- Vanilla JS
The UI package does not depend on the API. Install
@ton-pay/api only when API helpers are required.Add TON Connect provider
TON Pay UI uses TON Connect UI for wallet communication.The application must be wrapped with
TonConnectUIProvider and configured with an absolute URL to the TON Connect manifest. Add TonConnectUIProvider at the root of the application.Add a payment button
Add a
TonPayButton and provide a handler. The handler uses useTonPay to connect a wallet if needed, send a transaction through TON Connect, and track the transaction result.TonPayButtonwraps wallet connect and disconnect UX and invokes the provided handler.useTonPayaccepts an async message factory that receivessenderAddrand returns{ message }along with any tracking fields to propagate.
{ message } is a TON Connect transaction message. useTonPay forwards it to the wallet through TON Connect and initiates the transaction send; direct calls to the wallet SDK are not required.Client-only processing is fragileUsers can close the tab before transaction results are persisted, which breaks tracking and confirmation logic. Build messages and track transactions on the server side.
Minimal server‑side flow quick sample
Minimal server‑side flow quick sample
If an API key is available from the dashboard, pass it to
createTonPayTransfer options to enable automatic tracking and webhook notifications.Loading state and result handling
Loading state and result handling
This example shows a minimal loading state and how to surface the reference. If a transaction hash is available, an explorer link can be rendered.
Full example
This minimal example scaffolds a React app, installs TON Pay dependencies, and renders a working button wired to TON Connect. Replace the manifest URL andrecipientAddr with the necessary values.