Skip to content

docs: WebView integration guide for buyer-experience checkout#86

Merged
juanisierra merged 10 commits into
mainfrom
wcagent/webview-integration-docs
Jul 22, 2026
Merged

docs: WebView integration guide for buyer-experience checkout#86
juanisierra merged 10 commits into
mainfrom
wcagent/webview-integration-docs

Conversation

@walletconnect-agent

Copy link
Copy Markdown
Contributor

Adds documentation for the WebView rendering mode shipped in WalletConnect/buyer-experience#967.

What's in this PR

  • New page payments/wallets/webview.mdx — full integration guide covering:
    • How-it-works sequence diagram
    • URL construction (base gatewayUrl + mode=webview, callbackScheme, theme, themeVariables params)
    • JS bridge message reference (WC_PAY_COMPLETE / WC_PAY_CANCELLED / WC_PAY_ERROR)
    • Platform code examples: Android/Kotlin, iOS/Swift, React Native, Flutter
    • Server-side status verification reminder
    • Deep link / callbackScheme manifest setup (Android + iOS)
    • Best practices
  • docs.json — page wired into both 2026-02-18 and 2026-02-19.preview nav versions under "WalletConnect Pay for Wallets"
  • payments/wallets/overview.mdx — new "WebView Integration" card added to the integration options section

⚠️ Review notes

The specific query parameter names (mode, callbackScheme) and bridge message types (WC_PAY_COMPLETE etc.) are inferred from the existing IC-webview patterns and general convention — please verify them against the actual implementation in buyer-experience#967 and adjust before merging.

Slack thread: https://walletconnect.slack.com/archives/C0A2MNBKUAC/p1784118273297959

Covers URL construction, query params (mode, callbackScheme, theme, themeVariables), JS bridge messages (WC_PAY_COMPLETE/CANCELLED/ERROR), and platform examples for Android/Kotlin, iOS/Swift, React Native, and Flutter. Wires page into both docs.json nav versions and updates the wallets overview.
@mintlify

mintlify Bot commented Jul 15, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
wc-pay-docs 🟢 Ready View Preview Jul 15, 2026, 12:33 PM

@mintlify

mintlify Bot commented Jul 15, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
wc-pay-docs 🟡 Building Jul 15, 2026, 12:31 PM

…-examples#570

Fix param names (returnUrl, preferUniversalLinks — not mode/callbackScheme), message types (PAY_SUCCESS/PAY_FAILURE — not WC_PAY_*), add wallet deeplink interception pattern, update all four platform examples. Reference example links to the RN PR.
@walletconnect-agent

Copy link
Copy Markdown
Contributor Author

Updated with correct implementation details from reown-com/react-native-examples#570:

Corrected from first draft:

  • Query params: returnUrl (app deep link) + preferUniversalLinks=1 — not mode=webview/callbackScheme
  • Bridge messages: PAY_SUCCESS / PAY_FAILURE — not WC_PAY_*; also handles success: true/false boolean format
  • Added wallet deeplink interception pattern (?uri=wc:… URLs → Linking.openURL)
  • setSupportMultipleWindows note for React Native (required for onOpenWindow to fire)
  • Added reference card linking to the RN example PR

All four platform examples (React Native, Android/Kotlin, iOS/Swift, Flutter) updated accordingly.

Comment thread payments/wallets/webview.mdx Outdated
| Parameter | Required | Description |
|---|---|---|
| `returnUrl` | **Yes** | Your app's native deep link (e.g. `myapp://`). The checkout passes this to wallets as the return destination so the OS routes the user back after signing. |
| `preferUniversalLinks` | Recommended | Set to `1`. Tells the checkout to open wallets via universal links (`https://`) rather than custom URL schemes when both are available — more reliable on iOS. |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WalletConnectBot preferUniversalLinks is mandatory too, if not, the dapp wont be able to open the wallet to start the connection


## Prerequisites

- A `gatewayUrl` from the [Merchant API](/payments/ecommerce/integration) (`POST /v1/merchant/payment`)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ecommerce integration? is this ok?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ignaciosantise It's not required, right? if we do BX flow without ecommerce

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow the dapp needs a payment URL, that's why it added this as prerequisite

Comment thread payments/wallets/webview.mdx Outdated
Comment thread payments/wallets/webview.mdx Outdated
Co-authored-by: Ignacio Santise <25931366+ignaciosantise@users.noreply.github.com>
Co-authored-by: Ignacio Santise <25931366+ignaciosantise@users.noreply.github.com>
Wallet opens route through same-frame navigation (onShouldStartLoadWithRequest),
so onOpenWindow/setSupportMultipleWindows were dead code. Removes them from the
RN sample, drops the setSupportMultipleWindows Info note, trims the "handle both
window.open() calls" wording, clarifies the JS/DOM-storage best practice, and
points the reference card at the source folder on main instead of the PR.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Android: dispatch bridge callbacks to the main thread, fix bare
  {"success": false} handling via msg.has("success"), guard startActivity
  against ActivityNotFoundException, use rememberUpdatedState to avoid stale
  callbacks, and tear down the WebView onRelease to prevent leaks.
- iOS: inject a window.ReactNativeWebView.postMessage shim so the checkout's
  bridge messages reach WKWebView, and filter navigation schemes.
- Flutter: await launchUrl in an async onNavigationRequest with error handling.

Manually verified on each platform.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@juanisierra
juanisierra merged commit a8e3b8f into main Jul 22, 2026
4 checks passed
@juanisierra
juanisierra deleted the wcagent/webview-integration-docs branch July 22, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants