npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@walletconnect/pay

v1.0.7

Published

Pay SDK for WalletConnect - TypeScript wrapper for native uniffi module

Readme

WalletConnect Pay SDK

TypeScript SDK for WalletConnect Pay - a payment solution for React Native and web applications.

Installation

npm install @walletconnect/pay

React Native Setup

This SDK requires the WalletConnect React Native native module. Make sure you have @walletconnect/react-native-compat installed and linked in your React Native project.

Web Setup (Coming Soon)

WASM provider support for web browsers is coming in a future release.

Architecture

The SDK uses a provider abstraction that allows different implementations:

  • NativeProvider: Uses React Native uniffi module (current)
  • WasmProvider: Uses WebAssembly module (coming soon)

The SDK auto-detects the best available provider for your environment.

Usage

Initialize the Client

import { WalletConnectPay } from "@walletconnect/pay";

const client = new WalletConnectPay({
  appId: "your-app-id",
  // OR use apiKey instead:
  // apiKey: "your-api-key",
});

Get Payment Options

Retrieve available payment options for a payment link:

const options = await client.getPaymentOptions({
  paymentLink: "https://pay.walletconnect.com/pay_123",
  accounts: ["eip155:8453:0xYourAddress"], // CAIP-10 accounts
  includePaymentInfo: true,
});

console.log("Payment ID:", options.paymentId);
console.log("Options:", options.options);

Get Required Actions

Get the wallet RPC actions required to complete a payment option:

const actions = await client.getRequiredPaymentActions({
  paymentId: options.paymentId,
  optionId: options.options[0].id,
});

// Each action contains wallet RPC data to sign
for (const action of actions) {
  console.log("Chain:", action.walletRpc.chainId);
  console.log("Method:", action.walletRpc.method);
  console.log("Params:", action.walletRpc.params);
}

Sign and Confirm Payment

Sign the actions with your wallet and confirm the payment:

// Sign each action with your wallet (implementation depends on your wallet SDK)
const signatures = await Promise.all(
  actions.map((action) =>
    wallet.signTypedData(action.walletRpc.chainId, JSON.parse(action.walletRpc.params)),
  ),
);

// Confirm the payment
const result = await client.confirmPayment({
  paymentId: options.paymentId,
  optionId: options.options[0].id,
  signatures,
});

if (result.status === "succeeded") {
  console.log("Payment successful!");
} else if (result.status === "processing") {
  console.log("Payment is processing...");
}

Collected Data

Some payments may require additional user data:

const options = await client.getPaymentOptions({
  paymentLink,
  accounts,
});

if (options.collectData) {
  // Show UI to collect required fields
  const collectedData = options.collectData.fields.map((field) => ({
    id: field.id,
    value: getUserInput(field.name, field.fieldType),
  }));

  // Include collected data when confirming
  const result = await client.confirmPayment({
    paymentId: options.paymentId,
    optionId: selectedOptionId,
    signatures,
    collectedData,
  });
}

API Reference

WalletConnectPay

Constructor

new WalletConnectPay(options: WalletConnectPayOptions)

| Option | Type | Required | Description | | -------- | ------ | -------- | -------------------------------------------- | | appId | string | No* | App ID for authentication | | apiKey | string | No* | API key for authentication | | clientId | string | No | Client ID for tracking | | baseUrl | string | No | Custom API base URL | | logger | Logger | No | Custom logger instance or level |

* Either appId or apiKey must be provided for authentication.

Methods

getPaymentOptions(params)

Get available payment options for a payment link.

interface GetPaymentOptionsParams {
  paymentLink: string; // Payment link or ID
  accounts: string[]; // CAIP-10 accounts
  includePaymentInfo?: boolean; // Include payment info in response
}
getRequiredPaymentActions(params)

Get the wallet RPC actions required to complete a payment.

interface GetRequiredPaymentActionsParams {
  paymentId: string; // Payment ID
  optionId: string; // Selected option ID
}
confirmPayment(params)

Submit signatures and confirm the payment.

interface ConfirmPaymentParams {
  paymentId: string; // Payment ID
  optionId: string; // Selected option ID
  signatures: string[]; // Wallet RPC signatures
  collectedData?: CollectDataFieldResult[]; // Collected data fields
}
static isAvailable()

Check if a provider is available on the current platform.

Provider Utilities

import {
  isProviderAvailable,
  detectProviderType,
  isNativeProviderAvailable,
  setNativeModule,
} from "@walletconnect/pay";

// Check if any provider is available
if (isProviderAvailable()) {
  // SDK can be used
}

// Detect which provider type is available
const providerType = detectProviderType(); // 'native' | 'wasm' | null

// Check specifically for native provider
if (isNativeProviderAvailable()) {
  // React Native native module is available
}

// Manually inject native module (if auto-discovery fails)
import { NativeModules } from "react-native";
setNativeModule(NativeModules.RNWalletConnectPay);

Types

PaymentStatus

type PaymentStatus = "requires_action" | "processing" | "succeeded" | "failed" | "expired";

PaymentOption

interface PaymentOption {
  id: string;
  account: string; // CAIP-10 account for this option
  amount: PayAmount;
  etaS: number;
  actions: Action[];
}

Action

interface Action {
  walletRpc: WalletRpcAction;
}

interface WalletRpcAction {
  chainId: string;
  method: string;
  params: string; // JSON string
}

PayProviderType

type PayProviderType = "native" | "wasm";

Error Handling

The SDK throws typed errors for different failure scenarios:

import { PayError, PaymentOptionsError, ConfirmPaymentError } from "@walletconnect/pay";

try {
  const options = await client.getPaymentOptions({
    paymentLink: link,
    accounts,
  });
} catch (error) {
  if (error instanceof PaymentOptionsError) {
    console.error("Failed to get options:", error.originalMessage);
  } else if (error instanceof PayError) {
    console.error("Pay error:", error.code, error.message);
  }
}

License

WalletConnect Community License