Requirements
- Flutter 3.0+
- iOS 13.0+
- Android API 23+
- ReownWalletKit
Installation
Addreown_walletkit to your pubspec.yaml:
Check the pub.dev page for the latest version.
Initialization
TheWalletConnectPay client is automatically initialized during ReownWalletKit.init(). No additional setup is required.
Accessing the Pay Client
You can access theWalletConnectPay instance directly:
Payment Link Detection
Detect if a URI is a payment link before processing:Payment Flow
The payment flow consists of five main steps: Detect Payment Link -> Get Options -> Get Actions -> Sign Actions -> Confirm Payment1
Get Payment Options
Retrieve available payment options for a payment link:
2
Get Required Payment Actions
Get the required wallet actions for a selected payment option:
3
Collect User Data (If Required)
Some payments may require additional user data:
4
Confirm Payment
Confirm the payment with signatures and optional collected data:
Complete Example
Here’s a complete example of processing a payment:Direct Access
You can also access the underlyingWalletConnectPay instance directly if needed:
API Reference
ReownWalletKit Pay Methods
| Method | Description |
|---|---|
isPaymentLink(String uri) | Check if URI is a payment link |
getPaymentOptions({required GetPaymentOptionsRequest request}) | Get available payment options |
getRequiredPaymentActions({required GetRequiredPaymentActionsRequest request}) | Get actions requiring signatures |
confirmPayment({required ConfirmPaymentRequest request}) | Confirm and finalize payment |
pay | Access the underlying WalletConnectPay instance |
Models
GetPaymentOptionsRequest
PaymentOptionsResponse
PaymentInfo
PaymentOption
ConfirmPaymentRequest
ConfirmPaymentResponse
PaymentStatus
Error Handling
The SDK throws specific exception types for different error scenarios. All errors extend the abstractPayError class, which itself extends PlatformException:
| Exception | Description |
|---|---|
PayInitializeError | Initialization failures |
GetPaymentOptionsError | Errors when fetching payment options |
GetRequiredActionsError | Errors when getting required actions |
ConfirmPaymentError | Errors when confirming payment |
code: Error codemessage: Error messagedetails: Additional error detailsstacktrace: Stack trace
Example Error Handling
Best Practices
- Use WalletKit Integration: If your wallet already uses WalletKit, prefer this approach 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
Examples
For a complete example implementation with UI components showing the full payment flow, see the reown_walletkit example. The example demonstrates:- Payment link detection and processing
- Payment options retrieval with UI
- Data collection for compliance (KYB/KYC)
- Payment details display
- Transaction signing and confirmation
- Payment status polling and result display