gatewayUrl, handle JavaScript bridge messages for the outcome, and intercept wallet deeplinks so the OS can route the user to their wallet app and back.
The hosted UI handles wallet selection, payment option display, compliance data collection, and signing orchestration. Your app only needs to render a WebView, respond to the result, and verify it server-side.
How It Works
Prerequisites
- A
gatewayUrlfrom the Merchant API (POST /v1/merchant/payment) - Your app registered to handle its own deep link scheme (so wallets can return after signing)
- JavaScript and DOM storage enabled in the WebView
URL Construction
Start with thegatewayUrl the API returns and append the two WebView parameters. Never construct the base URL manually.
Bridge Messages
The checkout callswindow.ReactNativeWebView.postMessage(json) with a JSON string payload.
The checkout may send either the
type field or the success boolean (or both). Treat type === "PAY_SUCCESS" or success === true as a success signal; type === "PAY_FAILURE" or success === false as failure.Wallet Deeplink Interception
The checkout opens the user’s wallet by navigating to a URL that carries a?uri=wc:… query parameter. WebViews don’t handle these natively, so your app must intercept these navigations and forward them to the OS.
The checkout triggers this as a same-frame navigation, so intercepting navigation requests is all you need. Only forward URLs that carry a valid wc: URI — block any other non-https: navigation to prevent the page from driving the OS into arbitrary native schemes (tel:, sms:, intent:, etc.).
Platform Examples
- React Native
- Android (Kotlin)
- iOS (Swift)
- Flutter
Install the WebView package:
Deep Link Registration
Register yourreturnUrl scheme so the OS routes users back after signing in their wallet.
- Android
- iOS
Verifying Payment Status
AfterPAY_SUCCESS, confirm server-side before marking the order as paid:
Best Practices
- Enable JavaScript and DOM storage — both required. JavaScript renders the checkout; DOM storage backs its session and wallet state.
- Always intercept wallet deeplinks — URLs with
?uri=wc:…must be forwarded to the OS. The checkout triggers these as same-frame navigations, so intercepting navigation requests covers it. - Only intercept
wc:deeplinks — block other non-https:navigations to prevent arbitrary native app launches. - Handle both message formats — check
type === "PAY_SUCCESS"andsuccess === truefor forward compatibility. - Always verify server-side — treat bridge messages as a trigger to check status, not as proof of payment.
- Keep the WebView full-screen or modal — the checkout is optimized for full viewport rendering.
Reference Example
PayWebView — React Native example
Full implementation including success animation, wallet deeplink handling, and error recovery.