Before you start
- You have the Mesh SDK initialized and launching (see Launch the Mesh SDK)
Overview
When a user interacts with Link, Mesh fires SDK events that you can respond to in your app. The four callback functions below cover the most important moments in the user journey: connecting an account, completing a transfer, exiting, and responding to granular in-flow events.SDK callback functions
SDK-specific instructions for setting up callback functions
Web SDK initialization structure
Web SDK initialization structure
iOS Native SDK initialization structure
iOS Native SDK initialization structure
Android Native SDK initialization structure
Android Native SDK initialization structure
ReactNative SDK initialization structure
ReactNative SDK initialization structure
Flutter SDK initialization structure
Flutter SDK initialization structure
Example: Handle withdrawalRequested in onEvent()
In the Mesh-hosted withdrawal flow, Mesh fires withdrawalRequested when the user confirms a withdrawal, then Link closes. Use onEvent() to trigger any in-app step your withdrawal flow requires (eg. 2FA) and show the user the right screen next. See Add Mesh to your withdrawal flow for the full flow.
Web SDK example
Web SDK example
What’s next
Next up: Supercharge return-users — once you’re capturingaccessTokens via onIntegrationConnected, you’re ready to set up Mesh Managed Tokens for a seamless return-user experience.
AI coding reference (llms.txt)
AI coding reference (llms.txt)
AI coding reference — a compact summary of this page’s APIs, parameters, and patterns for use by AI coding assistants (following the llms.txt standard). Human readers can safely ignore this.llms.txt — Use Mesh’s callback functionsThe 4 SDK callback functions for responding to key user journey events. Wire all 4 in every SDK initialization.onIntegrationConnected(payload) — fires when user connects an exchange or wallet.
Key payload: iOS Swift — all 4 callbacks:Android Kotlin — callbacks via LaunchLink result:React Native — all 4 callbacks as JSX props:Flutter — callbacks via MeshConfiguration:
accessToken.accountTokens[].tokenId (store this for MMT) | accessToken.brokerType | brokerBrandInfo (icons/logos)onTransferFinished(payload) — fires when transfer flow completes. Use for immediate UI updates only; use webhooks for business logic.
Key payload: status (pending/succeeded/failed) | userId | transactionId | txId (exchange-specific) | transferId (Mesh-specific) | txHash | symbol | amount | amountInFiat | totalAmountInFiat | fromAddress | toAddress | refundAddress | networkId | networkNameonExit() — fires when user closes Link at any point.
Key payload: errorMessage | summary.page | selectedIntegration (name + Id) | transfer.previewIdonEvent(ev) — fires for granular in-flow events. Use for analytics and specific UX logic. See Mesh SDK events guide for full event list.Mesh-hosted withdrawals: in onEvent, check ev.type === 'withdrawalRequested' to trigger 2FA or update UI after the user confirms (Link closes). Payload is { transferId, status } (status: pending | success, pending in practice); no money movement details. Send funds only from the server-side withdrawal webhook.Critical: onTransferFinished fires when the provider acknowledges the request — not when it confirms on-chain. Always use webhooks for final confirmation before crediting users or releasing inventory.Web SDK — canonical initialization with all 4 callbacks: