Requirements
- iOS 13.0+
- Swift 5.7+
- Xcode 14.0+
- WalletKit (ReownWalletKit)
Pre-Requisites
In order to use your WalletConnect Pay, you need to obtain an App ID for your project from the WalletConnect Dashboard.How to obtain an App ID
- Navigate to the WalletConnect Dashboard.
- Select the project that is associated with your wallet (as in, the projectId that is being used for your wallet’s WalletConnect integration).

- Click on the “Get Started” button to get an App ID associated with your project.
- The Dashboard will now show the App ID associated with your project.
- Click on the three dots on the right of the App ID and select “Copy App ID”. You will be using this for your wallet’s WalletConnect Pay integration.

Installation
Swift Package Manager
Add ReownWalletKit to yourPackage.swift:
ReownWalletKit to your target dependencies:
Check the GitHub releases for the latest version.
Configuration
When using WalletKit, Pay is automatically configured using your project’sNetworking.projectId. No separate configuration is needed.
Payment Link Detection
Use the staticisPaymentLink method to detect payment links before processing:
isPaymentLink utility method detects WalletConnect Pay links by checking for:
pay.hosts (e.g., pay.walletconnect.com)pay=parameter in WalletConnect URIspay_prefix in bare payment IDs
Payment Flow
The payment flow consists of five main steps: Detect Payment Link -> Get Options -> Get Actions -> Sign Actions -> Confirm PaymentGet Payment Options
When a user scans a payment QR code or opens a payment link, fetch available payment options:
Sign Actions
Each action contains a
walletRpc with EIP-712 typed data that needs to be signed:Signing Implementation
Collect User Data (If Required)
If
options.collectData is not nil, you must collect user information before confirming:WebView-Based Data Collection
When a payment requires user information (e.g., for Travel Rule compliance), the SDK returns acollectDataAction with a url field pointing to a WalletConnect-hosted form page.Instead of building native forms, wallets display this URL in a WebView. The hosted form handles rendering, validation, and Terms & Conditions acceptance. When the user completes the form, the WebView communicates back to the wallet via JavaScript bridge messages.How It Works
- Check if
collectDataAction.urlis present in the payment options response - Open the URL in a WebView within your wallet
- Optionally append a
prefill=<base64-json>query parameter with known user data (e.g., name, date of birth, address). Use proper URL building to handle existing query parameters. - Listen for JS bridge messages:
IC_COMPLETE(success) orIC_ERROR(failure) - On
IC_COMPLETE, proceed toconfirmPayment()without passingcollectedData— the WebView submits data directly to the backend
The
collectDataAction also includes a schema field — a JSON schema string describing the required fields. The required list in this schema tells you which fields the form expects. Wallets can use these field names as keys when building the prefill JSON object. For example, if the schema’s required array contains ["fullName", "dateOfBirth", "pobAddress"], you can prefill with {"fullName": "...", "dateOfBirth": "...", "pobAddress": "..."}.WebView Message Types
The WebView communicates with your wallet through JavaScript bridge messages. The message payload is a JSON string with the following structure:| Message Type | Payload | Description |
|---|---|---|
IC_COMPLETE | { "type": "IC_COMPLETE", "success": true } | User completed the form successfully. Proceed to payment confirmation. |
IC_ERROR | { "type": "IC_ERROR", "error": "..." } | An error occurred. Display the error message and allow the user to retry. |
Platform-Specific Bridge Names
| Platform | Bridge Name | Handler |
|---|---|---|
| Kotlin (Android) | AndroidWallet | @JavascriptInterface onDataCollectionComplete(json: String) |
| Swift (iOS) | payDataCollectionComplete | WKScriptMessageHandler.didReceive(message:) |
| Flutter | ReactNativeWebView (injected via JS bridge) | JavaScriptChannel.onMessageReceived |
| React Native | ReactNativeWebView (native) | WebView.onMessage prop |
WebView Implementation
WhencollectData.url is present, display the URL in a WKWebView. The WebView handles form rendering, validation, and T&C acceptance.
Complete Example
Here’s a complete implementation using WalletKit:Deep Link Handling
To handle payment links opened from outside your app:QR Code Scanning
Payment links can be encoded as QR codes. Use theisPaymentLink utility for detection:
API Reference
WalletKit Integration
When using WalletKit, Pay methods are accessed viaWalletKit.instance.Pay.*.
Static Methods
| Method | Description |
|---|---|
WalletKit.isPaymentLink(_:) | Check if a string is a payment link (can call before configure()) |
Instance Methods (WalletKit.instance.Pay)
| Method | Description |
|---|---|
isPaymentLink(_:) | Check if a string is a payment link |
getPaymentOptions(paymentLink:accounts:includePaymentInfo:) | Fetch available payment options |
getRequiredPaymentActions(paymentId:optionId:) | Get signing actions for a payment option |
confirmPayment(paymentId:optionId:signatures:maxPollMs:) | Confirm and execute the payment |
Data Types
PaymentOptionsResponse
PaymentInfo
PaymentOption
PayAmount
Action & WalletRpcAction
CollectDataAction
ConfirmPaymentResultResponse
PaymentStatus
Error Handling
The SDK throws specific error types for different failure scenarios:GetPaymentOptionsError
| Error | Description |
|---|---|
.paymentNotFound | Payment ID doesn’t exist |
.paymentExpired | Payment has expired |
.invalidRequest | Invalid request parameters |
.invalidAccount | Invalid account format |
.complianceFailed | Compliance check failed |
.http | Network error |
.internalError | Server error |
GetPaymentRequestError
| Error | Description |
|---|---|
.optionNotFound | Selected option doesn’t exist |
.paymentNotFound | Payment ID doesn’t exist |
.invalidAccount | Invalid account format |
.http | Network error |
ConfirmPaymentError
| Error | Description |
|---|---|
.paymentNotFound | Payment ID doesn’t exist |
.paymentExpired | Payment has expired |
.invalidOption | Invalid option ID |
.invalidSignature | Signature verification failed |
.routeExpired | Payment route expired |
.http | Network error |
Best Practices
-
Use WalletKit Integration: If your wallet already uses WalletKit, prefer the
WalletKit.instance.Pay.*access pattern for automatic configuration -
Use
isPaymentLink()for Detection: Use the utility method instead of manual URL parsing for reliable payment link detection -
Account Format: Always use CAIP-10 format for accounts:
eip155:{chainId}:{address} - Multiple Chains: Provide accounts for all supported chains to maximize payment options
- Signature Order: Maintain the same order of signatures as the actions array
- Error Handling: Always handle errors gracefully and show appropriate user feedback
- Loading States: Show loading indicators during API calls and signing operations
-
Expiration: Check
paymentInfo.expiresAtand warn users if time is running low -
User Data: Only collect data when
collectDatais present in the response and you don’t already have the required user data. If you already have the required data, you can submit this without collecting from the user. You must make sure the user accepts WalletConnect Terms and Conditions and Privacy Policy before submitting user information to WalletConnect. -
WebView Data Collection: When
collectData.urlis present, display the URL in a WKWebView rather than building native forms. The WebView handles form rendering, validation, and T&C acceptance.