The WalletConnect Pay SDK allows wallet users to pay merchants using their crypto assets. The SDK handles payment option discovery, permit signing coordination, and payment confirmation while leveraging your wallet’s existing signing infrastructure.Documentation Index
Fetch the complete documentation index at: https://walletconnect-pay-docs-docs-add-ai-agent-sdk-section.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Sample Wallet
For a complete working example, check out our sample wallet implementation:Sample Wallet - Kotlin
A reference Android wallet app demonstrating WalletConnect Pay integration.
Requirements
- Min SDK: 23 (Android 6.0)
- Target SDK: 36
- JVM Target: 11
Installation
Add the WalletConnect Pay SDK to your project’sbuild.gradle.kts file:
The version shown above may not be the latest. Check the GitHub releases for the most recent version.
JNA Dependency Configuration
If you encounter JNA-related errors (e.g.,UnsatisfiedLinkError or class loading issues), explicitly configure the JNA dependency:
Configuration
Initialize the SDK in yourApplication class or before any payment operations:
Configuration Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey | String | No* | Your WalletConnect Pay API key |
appId | String | No* | Your WCP ID |
packageName | String | Yes | Your application’s package name |
*Either
apiKey or appId is required for authentication.Don’t have a project ID? Create one at the WalletConnect Dashboard by signing up and creating a new project.
Supported Networks & Tokens
WalletConnect Pay currently supports the following tokens and networks:| Token | Network | Chain ID | CAIP-2 Format |
|---|---|---|---|
| USDC | Arbitrum | 42161 | eip155:42161 |
| USDC | Base | 8453 | eip155:8453 |
| USDC | Polygon | 137 | eip155:137 |
| USDC | Ethereum | 1 | eip155:1 |
| USDC | Optimism | 10 | eip155:10 |
| USDC | Monad | 143 | eip155:143 |
| USDC | Celo | 42220 | eip155:42220 |
| USDC | BSC | 56 | eip155:56 |
| EURC | Ethereum | 1 | eip155:1 |
| EURC | Base | 8453 | eip155:8453 |
| USDT0 | Arbitrum | 42161 | eip155:42161 |
| PYUSD | Ethereum | 1 | eip155:1 |
| PYUSD | Arbitrum | 42161 | eip155:42161 |
| USDG | Ethereum | 1 | eip155:1 |
| USDT | Ethereum | 1 | eip155:1 |
| USDT | Polygon | 137 | eip155:137 |
| USDT | BSC | 56 | eip155:56 |
eip155:<chainId>:<address>
Include accounts for all supported networks to maximize payment options for your users.
Payment Flow
The payment flow consists of five main steps: Get Options -> Get Actions -> Sign Actions -> Collect Data (if required) -> Confirm PaymentGet Payment Options
When a user scans a payment QR code or opens a payment link, fetch available payment options:
Get Required Actions
After the user selects a payment option, get the wallet RPC actions needed to complete the payment:
Sign Actions
Sign each action using your wallet’s signing implementation:
Payment options may include multiple actions with different RPC methods. For example, a Permit2 payment where the user lacks sufficient allowance returns two actions: an
eth_sendTransaction to approve the token allowance, followed by an eth_signTypedData_v4 to sign the Permit2 transfer. Your wallet must check rpc.method (or action.action.method) and dispatch to the appropriate handler. For full implementation guidance, see USDT support.Collect User Data (If Required)
Some payments require collecting additional user information. Check for
collectData on the selected payment option:WebView-Based Data Collection
When a payment requires user information (e.g., for Travel Rule compliance), the SDK returns acollectData field on individual payment options. Each option may independently require data collection — some options may require it while others don’t.Recommended Flow (Per-Option)
The recommended approach is to display all payment options upfront, then handle data collection only when the user selects an option that requires it:- Call
getPaymentOptionsand display all available options to the user - Show a visual indicator (e.g., “Info required” badge) on options where
option.collectDatais present - When the user selects an option, check
selectedOption.collectData - If present, open
selectedOption.collectData.urlin 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
Decision Matrix
Response collectData | option.collectData | Behavior |
|---|---|---|
| present | present | Option requires IC — use option.collectData.url |
| present | null | Option does NOT require IC (others might) — skip IC for this option |
null | null | No IC needed for any option |
The
collectData 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", "dob", "pobAddress"], you can prefill with {"fullName": "...", "dob": "...", "pobAddress": "..."}.The top-level
collectData on the payment options response is still available for backward compatibility. However, the per-option collectData is the recommended approach as it provides more granular control over the flow.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
When a selected option hascollectData.url present, display the URL in a WebView. The WebView handles form rendering, validation, and T&C acceptance.
Complete Example
Here’s a complete implementation example using a ViewModel:API Reference
WalletConnectPay
Main entry point for the Pay SDK (singleton object).Properties
| Property | Type | Description |
|---|---|---|
isInitialized | Boolean | Whether the SDK has been initialized |
Methods
| Method | Description |
|---|---|
initialize(config: Pay.SdkConfig) | Initialize the SDK |
getPaymentOptions(paymentLink, accounts) | Get available payment options |
getRequiredPaymentActions(paymentId, optionId) | Get actions requiring signatures |
confirmPayment(paymentId, optionId, signatures) | Confirm and finalize payment |
Data Models
Pay.PaymentOptionsResponse
Pay.PaymentInfo
Pay.PaymentOption
Pay.Amount
Pay.WalletRpcAction
Pay.RequiredAction
Pay.CollectDataAction
Pay.ConfirmPaymentResponse
Pay.PaymentStatus
| Status | Description |
|---|---|
REQUIRES_ACTION | Additional action needed |
PROCESSING | Payment in progress |
SUCCEEDED | Payment completed |
FAILED | Payment failed |
EXPIRED | Payment expired |
CANCELLED | Payment cancelled by user |
Error Handling
The SDK provides typed errors for different failure scenarios:GetPaymentOptionsError
| Error | Description |
|---|---|
InvalidPaymentLink | Invalid payment link format |
PaymentExpired | Payment has expired |
PaymentNotFound | Payment ID doesn’t exist |
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 |
Example Error Handling
Best Practices
-
Initialize once: Call
initialize()only once, typically inApplication.onCreate() -
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
- Thread Safety: Events are delivered on IO dispatcher; update UI on main thread
-
WebView Data Collection: When
selectedOption.collectData?.urlis present, display the URL in a WebView rather than building native forms. The WebView handles form rendering, validation, and T&C acceptance. -
Per-Option Data Collection: When displaying payment options, check each option’s
collectDatafield. Show a visual indicator (e.g., “Info required” badge) on options that require data collection. Only open the WebView when the user selects an option withcollectDatapresent — use the option’scollectData.urlwhich is already scoped to that option’s account.