@giulio987/expo-wallet

中文文档
1.0.0发布于 2026/10/24MITTypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 1.2万

Add, read and manage Apple Wallet and Google Wallet passes from React Native / Expo, built with Nitro Modules

原始使用文档
文档目录7 节
  1. Installation
  2. Config plugin (iOS)
  3. Usage
  4. Example
  5. Development
  6. Contributing
  7. License

@giulio987/expo-wallet

Google Wallet Apple Wallet

Add passes to Apple Wallet and Google Wallet from React Native / Expo, and read the passes already in Apple Wallet. Built on Nitro Modules (JSI, no bridge).

v1 is a rewrite: the module is no longer an Expo Module (expo-modules-core) but a Nitro module. It needs a development build, Expo Go is not supported.

Installation

npx expo install @giulio987/expo-wallet react-native-nitro-modules
npx expo prebuild

Requires the New Architecture (default since Expo SDK 53) and Expo SDK 53+ / React Native 0.78+.

Config plugin (iOS)

getPasses, containsPass and removePass only see passes whose pass type identifier is listed in the app's com.apple.developer.pass-type-identifiers entitlement. The plugin adds it for you:

{
  "expo": {
    "plugins": [
      ["@giulio987/expo-wallet", { "passTypeIdentifiers": ["pass.com.example.mypass"] }]
    ]
  }
}

Without passTypeIdentifiers the plugin does nothing (the entitlement must be enabled on your App ID, so it is opt-in); existing identifiers are kept. The matching Pass Type ID must exist in your Apple Developer account and in the app's provisioning profile. Not using Expo? Add the entitlement in Xcode yourself.

Usage

import ExpoWallet, { AddToWalletButton } from "@giulio987/expo-wallet";

if (await ExpoWallet.isAvailable()) {
  // iOS: base64 encoded .pkpass   Android: signed Google Wallet JWT
  const added = await ExpoWallet.addPass(Platform.OS === "ios" ? pkpassBase64 : jwt);
  // true = added, false = user cancelled
}

const passes = await ExpoWallet.getPasses(); // iOS only

<AddToWalletButton buttonStyle="black" onPress={() => ExpoWallet.addPass(payload)} />;

Named exports (import { addPass } from ...) are available too.

APIiOSAndroid
isAvailable()PassKit availableGoogle Wallet API available
canAddPasses()yesalways false (use isAvailable)
addPass(data)base64 .pkpassGoogle Wallet JWT
addPasses(data[])yesrejects UNSUPPORTED
getPasses()yes (your pass type IDs)rejects UNSUPPORTED
containsPass(typeId, serial)yesrejects UNSUPPORTED
removePass(typeId, serial)yesrejects UNSUPPORTED
<AddToWalletButton />PKAddPassButtonsimple native button*

Google Wallet has no client API to list or remove saved passes, only a server-side REST API, hence the UNSUPPORTED rejections.

* The Android button is a plain black button. For production use, follow the Google Wallet brand guidelines and use the official "Add to Google Wallet" asset.

Errors are WalletErrors with a code from WALLET_ERRORS, e.g. if (e instanceof WalletError && e.code === WALLET_ERRORS.UNSUPPORTED).

addPass resolves true if the pass was added (on iOS also if it was already in Wallet) and false if the user cancelled. addPasses resolves true only if every pass ended up in Wallet.

Example

cd example
npm install
npx expo prebuild
npm run ios   # or: npm run android

Development

npm install
npm run specs   # regenerates nitrogen/generated after editing src/specs/*.nitro.ts
npm run build

Contributing

Issues and pull requests are welcome.

License

MIT

版本与发布记录

@giulio987/expo-wallet 共发布 7 个版本,首次发布于 2023/09/20;过去 12 个月发布了 1 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.0.0latest2026/10/2423 天前
0.1.52025/06/231.4 年前
0.1.42024/02/202 年前
0.1.32023/10/043 年前
0.1.22023/10/043 年前
0.1.12023/09/203 年前

关于 @giulio987/expo-wallet 的常见问题

@giulio987/expo-wallet 是什么?

Add, read and manage Apple Wallet and Google Wallet passes from React Native / Expo, built with Nitro Modules

如何安装 @giulio987/expo-wallet?

在项目目录运行 npm install @giulio987/expo-wallet,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(*)、react-native(*)、react-native-nitro-modules(>=0.37.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@giulio987/expo-wallet 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@giulio987/expo-wallet 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@giulio987/expo-wallet 可以商用吗?

@giulio987/expo-wallet 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@giulio987/expo-wallet 的下载量有多少?

根据 npm 官方下载统计,@giulio987/expo-wallet 在 2026/10/17 – 2026/11/15 这 30 天内被下载 11,936 次,日均约 398 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@giulio987/expo-wallet 还在维护吗?

最新版本 1.0.0 发布于 2026/10/24(23 天前);至今共发布 7 个版本,其中过去 12 个月发布了 1 个;首次发布于 2023/09/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。