WalletConnect Pay Integration Guide for Flutter (via WalletKit)
This guide enables Flutter wallet developers to integrate WalletConnect Pay for processing crypto payment links through reown_walletkit. The integration allows wallet applications to accept and process payment requests from merchants using the WalletConnect Pay protocol.
Important Approach
Study and adapt, don’t blindly copy. Before implementing, examine how your existing wallet app handles:
- Deep links and QR code scanning
- Modal/bottom sheet presentation
- State management patterns
- Signing implementations for different methods
Maintain consistent architecture and naming conventions with your existing codebase.
Prerequisites
Before starting, ensure your wallet app has:
- WalletKit SDK integrated (
reown_walletkit: ^1.5.1 package or newer, which bundles walletconnect_pay 1.1.0)
- EVM signing capability supporting:
eth_signTypedData_v4 (EIP-712 typed data signing)
personal_sign (message signing)
- Async/await patterns for handling asynchronous operations
- UI modal/bottom sheet system for presenting payment flows
- Understanding of CAIP-10 account format:
{namespace}:{chainId}:{address} (e.g., eip155:1:0x1234...)
Core Concepts
Payment Flow Overview
- Payment Link Detection: Identify incoming payment links from QR codes, deep links, or text input
- Get Payment Options: Retrieve available payment methods with merchant information
- WebView Data Collection (optional): Display WebView form for KYC/compliance data if required by the payment. The WebView submits data directly to the backend, so this must happen BEFORE fetching actions.
- Get Actions: Fetch the required signing actions via
getRequiredPaymentActions (only needed when the selected option’s actions are empty)
- Sign Actions: Execute wallet signing operations (typically
eth_signTypedData_v4)
- Confirm Payment: Submit the wallet RPC results (
data) to complete the transaction
- Handle Result: Display success/failure and handle polling if needed
Key Data Models
Step-by-Step Integration
Step 1: Dependency Setup
The walletconnect_pay package is already a dependency of reown_walletkit and is re-exported. No additional dependencies are needed.
All Pay-related types are exported from reown_walletkit:
Step 2: WalletKit Initialization
Pay is automatically initialized when you call walletKit.init(). No separate Pay configuration is required.
Step 3: Payment Link Detection
Use walletKit.isPaymentLink() to detect payment links. This check must occur at ALL URI entry points in your app.
CRITICAL: Add payment link detection to:
- QR code scanner results
- Deep link handlers (cold start and warm start)
- Paste/text input handlers
- Universal link handlers
Important: Payment links are HTTPS URLs. Ensure the isPaymentLink() check happens BEFORE any generic HTTPS URL handling to prevent opening payment links in a browser.
Step 4: Get Payment Options
Retrieve available payment options using the wallet’s accounts in CAIP-10 format.
Response Structure:
Step 5: Handle Data Collection via WebView
If the selected option’s collectData is not null and has a url, display the URL in a WebView for data collection. The hosted form handles rendering, validation, and T&C acceptance.
The form URL accepts optional query parameters — append them to selectedOption.collectData.url before loading, preserving existing query parameters:
prefill — base64url-encoded JSON of known user fields. Keys must match the required fields from collectData.schema (e.g. fullName, dob, pobAddress).
theme — light or dark, to match your wallet’s color mode.
themeVariables — a base64url string exported from the WalletConnect Pay Dashboard that overrides design tokens (font, font size, some colors, button/input border radius). Append it verbatim.
Important: When using the WebView approach, do not pass collectedData to confirmPayment(). The WebView submits data directly to the backend.
Add webview_flutter and url_launcher to your dependencies:
Step 6: Get Required Payment Actions
If the selected payment option has empty actions, fetch them explicitly.
Action Structure:
Step 7: Sign Payment Actions
CRITICAL: The params field contains a JSON string. Handle it appropriately for your signing library.
EIP-712 Typed Data Signing (eth_signTypedData_v4)
Personal Sign
Step 8: Confirm Payment
Submit the wallet RPC results (data) to complete the payment. Each element of data is either a plain String (a signature or transaction hash) or, for chains like Tron, a Map<String, dynamic> JSON object; the SDK forwards each element verbatim. See Tron support for the Tron payload.
CRITICAL: The data list must match the actions array order exactly. Misalignment causes payment failures.
The signatures parameter is deprecated in favor of data and will be removed in a future major version. Existing integrations that pass signatures keep working; the SDK uses it as a fallback when data is null.
Step 9: Handle Payment Result
Complete Payment Flow Example
UI Implementation Guidelines
Recommended Screens/Modals
- Loading State: Show while fetching payment options
- Payment Details: Display merchant info, amount, and payment options
- Data Collection (conditional): Collect required fields
- Processing State: Show while confirming payment
- Result Screen: Success or failure with details
Example Modal Structure
Utility Functions
Error Handling
Error Types
Common Error Codes
GetPaymentOptions:
PaymentExpired - Payment link has expired
PaymentNotFound - Invalid payment link
InvalidAccount - Provided account format is invalid
ComplianceFailed - Compliance check failed
ConfirmPayment:
InvalidSignature - Signature verification failed
PaymentExpired - Payment expired during process
RouteExpired - Selected payment route expired
UnsupportedMethod - Signing method not supported
Error Handling Pattern
Common Pitfalls
Wrong: 0x1234...
Correct: eip155:1:0x1234... (CAIP-10 format)
2. Result Order
CRITICAL: data must be in the same order as actions.
3. JSON Params Handling
The walletRpc.params is a JSON string. Parse appropriately:
4. Hex Value Normalization
Some hex values may have odd length. Normalize before signing:
5. Deep Link Handling Order
Check for payment links BEFORE generic URL handling:
6. Empty Actions
Payment options may have empty actions array initially. Always check and fetch if needed:
Testing
Test Payment Links
Create test payment links from the WalletConnect Pay dashboard using a test-mode API key:
Debug Logging
Enable logging during development:
Summary
Quick Reference - API Methods
Integration Checklist
Reference Implementation
See the complete working implementation in the WalletKit example app:
packages/reown_walletkit/example/lib/dependencies/walletkit_service.dart
packages/reown_walletkit/example/lib/walletconnect_pay/ (UI modals)
packages/reown_walletkit/example/lib/dependencies/chain_services/evm_service.dart (signing)
Resources