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
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 | Renders inline; omit for modal (default) |
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 |
paymentStarted | User’s deposit transaction is detected |
paymentCompleted | Funds delivered to destination |
payload object is empty. To get full session details (tx hash, chain, amounts, etc.) after any event, poll GET /v1/sessions/{sessionId}.
Theming
To customize the payment UI, pass athemeCssUrl in display when creating the session. This lets you override colors, radii, and other visual tokens. See Custom theming with themeCssUrl for the full list of CSS custom properties.
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, "*")