User flow
- Cashier selects “Pay with Crypto” on the POS.
- POS shows a WalletConnect QR code with the payment intent.
- Customer scans the QR code with their wallet.
- Wallet displays the payment amount and the customer approves.
- The transaction is broadcasted by the wallet.
- POS shows confirmation when payment is successful.
SDK Methods
The WalletConnect POS SDK exposes methods and callbacks to create smooth payment flows.The methods here are shown in isolation, for a full guide on how to use them follow the step by step guide at the bottom.
Initialization
To initialize the SDK, call theinit method with your API credentials:
| Parameter | Type | Description |
|---|---|---|
| apiKey | String | Your WalletConnect Pay merchant API key |
| merchantId | String | Your merchant identifier |
| deviceId | String | Unique identifier for this POS device |
Payment Intent
A payment intent specifies the amount to be paid and the currency. Currently, only USD is supported.Pos.Amount has the following fields:
| Parameter | Type | Description |
|---|---|---|
| unit | String | Currency in ISO 4217 format: "iso4217/{CURRENCY}" (e.g., "iso4217/USD", "iso4217/EUR") |
| value | String | Amount in minor units (e.g., "1000" = $10.00 USD) |
| referenceId | String | Merchant’s reference ID for this payment (can be empty) |
- Creates the payment intent on the server
- Generates the connection URL and QR code
- Sends the connection proposal to the wallet
- Awaits the connection result
- Builds and sends the transaction to the wallet
- Awaits the transaction result from the wallet
- Polls the transaction status until completion
Payment intent life cycle
The WalletConnect POS SDK emits events through a delegate that allow you to adapt the POS UI depending on the status of the payment.How to Integrate the POS SDK
Below are the steps to integrate the Kotlin POS SDK into your project.Prerequisites
To use the POS SDK you will need the following:- API Key and Merchant ID from WalletConnect Pay
- Latest SDK (WalletConnect Kotlin):
com.walletconnect:pos:0.0.1 - Requirements: Android min SDK 23
Integration Steps
1
Add the Kotlin POS SDK dependencies
First, add the dependencies to your project’s
build.gradle.kts file as shown below:/app/build.gradle.kts
2
Initialize the POS client
Initialize the POS client in your
Application class:3
Set up the delegate
It’s important that you register the delegate before triggering a payment, or you risk missing early events like Register the delegate after initialization:
PaymentCreated.Create a delegate to receive payment events:4
Initiate the payment
Now, you can create a payment intent and initiate the payment:
5
Render QR code and handle events
Handle the
PaymentCreated event to display the QR code. You can use the uri from the event to generate a QR code. On successful connection, you’ll receive PaymentRequested which you can use to show a loading spinner indicating that the payment request is being processed.Projects need to create their own UI.Example event handling in a ViewModel:6
Observe payment status
The SDK automatically polls for payment status and emits events through the delegate:
PaymentRequested→ Customer scanned QR and initiated paymentPaymentProcessing→ Transaction submitted on-chainPaymentSuccess→ Payment confirmed and completedPaymentError→ Payment failed (see Error Handling below)
Error Handling
Handle payment errors by checking thePaymentError event type:
Additional Methods
Cancel an Active Payment
Call when user cancels the payment flow:Check Payment Status
For checking status without polling (one-off check):Amount Formatting
ThePos.Amount class provides a formatting helper:
Shutdown SDK
Call when SDK is no longer needed (e.g., app termination):API Reference Summary
| Method | Description |
|---|---|
PosClient.init(apiKey, merchantId, deviceId) | Initialize the SDK (required before any other calls) |
PosClient.setDelegate(delegate) | Set delegate for receiving payment events |
PosClient.createPaymentIntent(amount, referenceId) | Create payment and start polling |
PosClient.cancelPayment() | Cancel active payment/polling |
PosClient.checkPaymentStatus(paymentId) | One-off status check (suspend function) |
PosClient.shutdown() | Release all SDK resources |
Important Notes
-
Initialize once - Call
init()only once, typically inApplication.onCreate() - Set delegate early - Set delegate before creating payments to avoid missing events
- Minor units - Amount value is in minor units (cents for USD, not dollars)
-
Cancel before new payment - Call
cancelPayment()if user exits payment flow - Thread safety - Events are delivered on IO dispatcher; update UI on main thread