WKWebView, Android
WebView, or a plain react-native-webview). No SDK installation required —
create a session and construct a URL.
On React Native, prefer
DaimoFrameRN from @daimo/sdk —
it handles sizing, dismissal, and deeplink hand-off for you. Use this guide
when you can’t add the SDK, or you’re on native iOS / Android.How it works
- Create a session via the API
- Construct the webview URL from the session ID and client secret
- Load that URL in your native WebView
- Listen for
postMessageevents to track payment progress
Create a session
Load the WebView
iOS (Swift)
Android (Kotlin)
React Native (without the SDK)
Query parameters
| Parameter | Required | Values | Description |
|---|---|---|---|
session | Yes | string | Session ID |
cs | Yes | string | Client secret |
locale | No | es, fr, etc. | UI language (default: browser locale) |
theme | No | light, dark | Color theme (default: auto) |
layout | No | embed, center | embed renders inline; center vertically centers full-height |
Handle events
The WebView sends messages viapostMessage. The message format:
| Event | Description |
|---|---|
ready | Payment UI finished loading |
modalOpened | Modal became visible |
modalClosed | Modal was dismissed |
contentHeightChanged | Embedded content height changed in layout=embed |
paymentStarted | User’s deposit transaction is detected |
paymentCompleted | Funds delivered to destination |
payload object is empty. In
layout=embed, contentHeightChanged includes { "height": number } in CSS
pixels. To get full session details (tx hash, chain, amounts, etc.) after any
payment event, poll GET /v1/sessions/{sessionId}.
Fit embedded height
When you load the webview inside your own modal or bottom sheet, addlayout=embed and size the host container to the reported content height. This
avoids showing a full-screen webview with empty space below the payment UI.
layout=embed sends contentHeightChanged. In React Native, store that
height and apply it to the WebView:
Center full-height WebViews
When the WebView itself fills the screen, addlayout=center to center the
payment UI in a full-height themed WebView shell:
contentHeightChanged; the host WebView should own the
full available height.
Theming
Set your org theme in the Daimo dashboard to match the hosted payment UI to your brand. The WebView loads it automatically from the session. Choose Automatic, Light, or Dark in dashboard customization to control the default active mode. Passtheme=light or theme=dark to override it for a
specific WebView.
See Customization for the dashboard flow and token list.
sendToHost protocol
The webview page communicates with the host container via asendToHost
function that tries three transport layers in order:
- React Native / Expo —
window.ReactNativeWebView.postMessage(JSON.stringify(msg)) - iOS / macOS WKWebView —
window.webkit.messageHandlers.daimoPay.postMessage(msg) - Browser iframe / desktop WebView —
window.parent.postMessage(msg, "*")