一般卡券概览
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
如果您的用例不属于任何其他预定义卡券类型,便可使用通用卡券。与其他包含特定于某个用例的字段和功能(例如票券、会员卡和优惠)的卡券不同,通用卡券的设计非常灵活,它提供可用于定义自定义标签和值的字段,以支持多种用途。
用例示例
下面列举了使用通用卡券类型可以执行的操作的一些示例:
- 停车券
- 借阅证
- 会员卡
- 保险卡
- 预订确认
- 客户预过滤确认码
在某些情况下,您的卡券或用例可能涉及个人身份信息 (PII) 和健康数据等敏感信息。对于这些场景,通用私人凭证类型适用于已预先批准的用例。如需了解详情,请参阅通用私人凭证文档和使用限制政策 (AUP)。
借助 Google Wallet API,您可以分发卡券,供用户跨多个平台(包括 Android 应用)以及任何支持超链接的位置(例如网站、电子邮件和短信)保存至其 Google 钱包。
API 和 SDK
Google Wallet API 提供 REST API 和 Android SDK,可帮助您快速轻松地发放和管理卡券。
注意:使用 Google Wallet API 时,无需使用 Google Wallet REST API 或 Google Wallet Android SDK,但我们强烈建议您使用。如需详细了解如何在不使用 REST API 或 Android SDK 的情况下颁发卡券,请参阅在 JWT 中创建卡券对象和卡券类。
要求
如需使用 Google Wallet API 颁发卡券,您首先需要执行以下操作:
Google Wallet API 使用入门
开始使用 Google Wallet API 之前,请先阅读这些实用文章,熟悉基本功能和术语。
- 主要概念和术语:本文将向您介绍使用 Google Wallet API 所需的所有重要术语和功能。
- 卡券类和对象概览:您发送给用户的卡券是通过将卡券类与卡券对象结合使用来创建的。本文介绍了这两个概念,以及如何使用它们创建卡券。
- Google 钱包卡券开发流程:本文从头到尾全面介绍了使用 Google Wallet API 创建卡券所需的所有步骤。
- Codelab
自学 Codelab 会引导您完成将卡券添加到 Google 钱包的必要步骤。首先,如果您的实现将仅在 Android 设备上实现,请选择“Android”;如果您的实现支持 Android、Web、电子邮件或短信,请选择“Web”。
Android
Web
- 卡券构建器
使用卡券构建器工具直观地构建您的第一个卡券,并自动生成使用 Google Wallet API 创建卡券所需的 JSON。
- Google 钱包 GitHub
访问 Google 钱包 GitHub 组织,获取适用于各种编程语言的实用工具、库和示例代码。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-29。
[null,null,["最后更新时间 (UTC):2025-08-29。"],[[["\u003cp\u003eThe Generic Pass is a versatile pass type in Google Wallet, suitable for various use cases beyond standard tickets or loyalty cards, allowing custom data through defined labels and values.\u003c/p\u003e\n"],["\u003cp\u003eSensitive information like PII should be handled using the Generic Private pass type, with pre-approval needed for specific use cases.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Wallet API enables pass creation and management across Android, web, and messaging platforms through REST API and Android SDK.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers need a Google Wallet API Issuer Account, along with a Google Cloud Account (non-Android) or Google Play Services setup (Android).\u003c/p\u003e\n"],["\u003cp\u003eGoogle offers resources like codelabs, a pass builder tool, and GitHub repositories to help developers integrate and utilize the Google Wallet API effectively.\u003c/p\u003e\n"]]],["The Generic Pass in Google Wallet supports diverse purposes with custom labels and values, such as parking, library, or membership cards. For sensitive data, there's a Generic Private pass option. Passes can be issued across platforms, using the REST API for web, email, or SMS, and the Android SDK for Android apps. Issuers need a Google Wallet API account; non-Android developers also need a Google Cloud account. Key resources include codelabs, a pass builder, and the Google Wallet GitHub.\n"],null,["# Generic Pass overview\n\nThe Generic Pass is available for when your use case doesn't fit into any of the\nother predefined pass types. Unlike other passes that include fields and features\nthat are specific to a use case, such as tickets, loyalty cards, and offers, the\nGeneric Pass is intended to be flexible enough to support a variety of purposes\nby providing fields where you can define custom labels and values.\n\nExample use cases\n-----------------\n\nThe following are just a few examples of what you can do with the Generic pass\ntype:\n\n- Parking passes\n- Library cards\n- Membership cards\n- Insurance cards\n- Reservation confirmations\n- Customer pre-screen confirmation codes\n\nPasses that include sensitive information\n-----------------------------------------\n\nThere are cases where your pass or use case may involve sensitive information,\nsuch as personally identifiable information (PII) and health data. For these\nscenarios, the Generic Private pass type is available for pre-approved use\ncases. For more information, see the [Generic Private Pass documentation](/wallet/generic-private-pass)\nand the [Acceptable Use Policy (AUP)](https://payments.developers.google.com/terms/aup#sensitive-data).\n\nSupported platforms\n-------------------\n\nWith the Google Wallet API, you can issue passes for your users to save in their Google Wallet across multiple platforms, including Android apps, and anywhere hyperlinks are supported, such as websites, email, and SMS messages.\n\n### APIs \\& SDKs\n\nThe Google Wallet API offers a REST API and an Android SDK to help you issue and manage your passes quickly and easily.\n\n- [Google Wallet REST API](/wallet/generic/web/prerequisites) \n\n To issue passes on platforms such as the Web, email, or SMS, we recommend you use the Google Wallet REST API. The API provides a set of endpoints that let you create, retrieve, and update the various components of passes.\n- [Google Wallet Android SDK](/wallet/generic/android/prerequisites) \n\n To issue passes in an Android app, we recommend you use the Google Wallet Android SDK. The SDK provides a variety of convenience methods that make it easy to integrate the Google Wallet API into your mobile apps using native code.\n\nNote: Using the Google Wallet REST API or Google Wallet Android SDK is not required to issue passes with the Google Wallet API, but are strongly recommended. For more information on issuing passes without using the REST API or Android SDK, see [Creating Passes Objects and Passes Classes in the JWT](https://developers.google.com/wallet/retail/offers/overview/add-to-google-wallet-flow#creating-passes-objects-and-passes-classes-in-the-jwt).\n\nRequirements\n------------\n\nTo issue passes with the Google Wallet API, you will first need to do the following:\n\n- Create a [Google Wallet API Issuer account](/wallet/generic/getting-started/issuer-onboarding).\n- Non-Android developers: Create a [Google Cloud account](https://console.cloud.google.com/freetrial).\n- Android developers: [Set up Google Play services.](/android/guides/setup)\n\nGetting started with the Google Wallet API\n------------------------------------------\n\nBefore you start working with the Google Wallet API, take a look at these useful articles that will familiarize you with the basic features and terminology.\n\n- [Key concepts and terminology](/wallet/generic/resources/terminology): This article will familiarize you with all the important terms and features you will need to work with the Google Wallet API.\n- [Passes Classes and Objects overview](/wallet/generic/overview/how-classes-objects-work): Passes that you issue to your users are created by combining a Passes Class with a Passes Objects. This article will familiarize you with both of these concepts, and how they are used to create passes.\n- [Google Wallet pass development flow](/wallet/generic/overview/add-to-google-wallet-flow): This article provides an end-to-end overview of all of the steps needed to create a pass with the Google Wallet API from start to finish.\n\n### Tools \\& resources\n\n- **Codelabs** \n\n\n Self-guided codelabs walk you through the necessary steps to add a pass\n to Google Wallet. To get started, choose \"Android\" if your implementation will be on Android devices\n only and choose \"Web\" if your implementation supports Android, Web, Email or SMS.\n\n\n [Android](https://g.co/wallet/android-codelab)\n [Web](https://g.co/wallet/web-codelab)\n- **Pass builder** \n\n Build your first pass visually with the [pass builder](/wallet/generic/resources/pass-builder) tool, and automatically generate the JSON you need to create the pass with the Google Wallet API.\n- **Google Wallet Github**\n\n Get helpful tools, libraries and sample code for a variety of programming languages in the [Google Wallet Github org](https://github.com/google-wallet)."]]