# @giulio987/expo-wallet 中文文档

规范地址：https://npmcn.com/package/%40giulio987/expo-wallet/

版本：1\.0\.0
npm 元数据更新时间：2026-10-23T16:27:37.936Z
中文译文更新时间：2026-11-16T14:52:42.314Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40giulio987/expo-wallet
原文对照：https://npmcn.com/package/%40giulio987/expo-wallet/?lang=original
项目主页：https://github.com/Giulio987/expo-wallet#readme
源码仓库：https://github.com/Giulio987/expo-wallet

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：201 kB，100 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：0 个
- peer 依赖：react \*，react-native \*，@expo/config-plugins \*，react-native-nitro-modules \>=0\.37\.0
- 首次发布：2023-09-20T14:52:18.190Z
- 最新版本发布：2026-10-23T16:27:37.367Z
- 近 30 天下载量：11936（2026-10-17 至 2026-11-15，npm 官方下载统计）
- 已发布版本数：7（近 12 个月 1 个）

## 中文简介

添加、读取和管理苹果钱包和Google钱包, 由 Nitro 模块创建 React Industrial / Expo 通过

## 安装

```sh
npm install @giulio987/expo-wallet
```

也可以使用：`pnpm add @giulio987/expo-wallet`、`yarn add @giulio987/expo-wallet`、`bun add @giulio987/expo-wallet`

## README

# @giulio987/expo-wallet(英语:

![Google Wallet](https://uxwing.com/wp-content/themes/uxwing/download/brands-and-social-media/google-wallet-icon.png) ![Apple Wallet](https://is1-ssl.mzstatic.com/image/thumb/PurpleSource211/v4/6d/0c/ef/6d0cefd3-4758-d4b9-0227-8cfea8a116ca/Placeholder.mill/400x400Icon.ApSiOS01-75.webp)

添加通行证到 **苹果钱包** 财务报告和审定财务报表 **谷歌钱包** 从React Industrial / Expo,并读取已经用苹果钱包的通行证. 建造在 [硝基模块](https://nitro.margelo.com/) (JSI,无桥.

v1 是一个重写: 该模块不再是 Expo 模块 (`expo-modules-core`)但是一个硝基模组. 它需要一个开发建设, 博览会Go不支持.

## 安装

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

需要新架构(自世博会SDK 53起的默认)和世博会SDK 53+ / React Introduct 0.78+.

### 配置插件( iOS)

`getPasses`, (中文(简体) ), `containsPass` 财务报告和审定财务报表 `removePass` 只看到通过 _通过类型标识符_ 在应用程序中列出 `com.apple.developer.pass-type-identifiers` 权利。 插件为您添加 :

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

无 `passTypeIdentifiers` 插件无所事事(必须在您的 App ID 上启用该权限,所以它被选入); 保存已有的标识符。 匹配的 Pass 类型 ID 必须存在于您的 Apple 开发者账户和应用程序的提供配置中 。 不利用博览会? 自己在 Xcode 中加入权利 .

## 使用量

```ts
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)} />;
```

命名出口( E)`import { addPass } from ...`) 也可以使用.

| API 密码 | iOS系统 | 机器人 |
| --- | --- | --- |
| `isAvailable()` | 可用密码Kit | Google 钱包 API 可用 |
| `canAddPasses()` | 对 | 永远 `false` (使用时 `isAvailable`(中文(简体) ) |
| `addPass(data)` | 基础64 `.pkpass` | 谷歌钱包 JWT |
| `addPasses(data[])` | 对 | 拒绝 `UNSUPPORTED` |
| `getPasses()` | 是(您的通行证类型) | 拒绝 `UNSUPPORTED` |
| `containsPass(typeId, serial)` | 对 | 拒绝 `UNSUPPORTED` |
| `removePass(typeId, serial)` | 对 | 拒绝 `UNSUPPORTED` |
| `<AddToWalletButton />` | `PKAddPassButton` | 简单本地按钮\* |

Google 钱包没有客户端 API 来列出或删除保存的通行证,只有服务器侧的 REST API,因此 `UNSUPPORTED` 拒绝.

\*Android按钮是一个纯黑色的按钮. 用于生产 [谷歌钱包品牌指南](https://developers.google.com/wallet/generic/resources/brand-guidelines) 并使用"添加到谷歌钱包"的官方资产.

错误是 `WalletError`s 与一个 `code` 从 `WALLET_ERRORS`,比如说. `if (e instanceof WalletError && e.code === WALLET_ERRORS.UNSUPPORTED)`。 。 。 .

`addPass` 决定 `true` 如果通行证是添加的(在iOS上,如果它已经在钱包里)和 `false` 如果用户取消. `addPasses` 决定 `true` 只要每个传球都落到钱包里.

## 示例

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

## 发展

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

## 捐款

欢迎提出问题和拉动请求.

## 许可证

麻省理工学院

## 常见问题

### @giulio987/expo-wallet 是什么？

添加、读取和管理苹果钱包和Google钱包, 由 Nitro 模块创建 React Industrial / Expo 通过

### 如何安装 @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 和提交记录判断。

