Skip to main content

User flow

  1. Cashier selects “Pay with Crypto” on the POS.
  2. POS shows a WalletConnect QR code with the payment intent.
  3. Customer scans the QR code with their wallet.
  4. Wallet displays the payment amount and the customer approves.
  5. The transaction is broadcasted by the wallet.
  6. 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 the init method with your API credentials:
Where the initialization parameters are:
All parameters are required and cannot be blank. The SDK will throw IllegalStateException if validation fails.

Payment Intent

A payment intent specifies the amount to be paid and the currency. Currently, only USD is supported.
Where the Pos.Amount has the following fields: What it does under the hood:
  • 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.
Event Flow: PaymentCreated → PaymentRequested → PaymentProcessing → PaymentSuccess ↘ PaymentError

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 PaymentCreated.Create a delegate to receive payment events:
Register the delegate after initialization:
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 payment
  • PaymentProcessing → Transaction submitted on-chain
  • PaymentSuccess → Payment confirmed and completed
  • PaymentError → Payment failed (see Error Handling below)
Depending on the different status, it’s recommended to adapt the UI to show feedback to the user.

Error Handling

Handle payment errors by checking the PaymentError event type:

Additional Methods

Cancel an Active Payment

Call when user cancels the payment flow:
This stops any active polling and allows starting a new payment.

Check Payment Status

For checking status without polling (one-off check):

Amount Formatting

The Pos.Amount class provides a formatting helper:

Shutdown SDK

Call when SDK is no longer needed (e.g., app termination):

API Reference Summary

Important Notes

  1. Initialize once - Call init() only once, typically in Application.onCreate()
  2. Set delegate early - Set delegate before creating payments to avoid missing events
  3. Minor units - Amount value is in minor units (cents for USD, not dollars)
  4. Cancel before new payment - Call cancelPayment() if user exits payment flow
  5. Thread safety - Events are delivered on IO dispatcher; update UI on main thread