兑换通用卡券
卡券可通过以下两种方式兑换:
您可以选择在用户兑换或访问卡券时要求采取额外的安全措施。如需了解详情,请参阅使用屏幕锁定功能提供保护。
NFC 触碰
您的用户可通过 NFC 触碰无缝兑换卡。详细了解智能触碰,并注册使用智能触碰功能。
条形码扫描
通过附加条形码帮助客户扫描卡券。
静态条形码
您可以通过设置 object.barcode
来显示静态条形码。此 API 提供了各种类型的条形码。如需了解详情,请参阅 Barcode
类型。
轮换条形码
为提高安全性,您可以通过设置 object.rotatingBarcode
显示轮替条形码。旋转的条形码看起来和常规条形码一样,但定期更改,通常是每分钟更改,并且终端/读取器已编程为仅接受最新的条形码。这样可以降低与条形码屏幕截图(尤其是门票被盗或未经授权的门票转销)相关的风险。如需了解详情,请参阅 RotatingBarcode
类型。
安全动画
防止滥用屏幕截图的另一种方法是显示条形码安全动画,该动画支持对卡券进行人工验证。
安全动画的实际表现形式是卡券条形码周围的闪烁轮廓。这种闪烁动画仅在设备处于运动状态时触发,因此用户可以通过倾斜设备来测试卡券的有效性。另一方面,如果让设备保持静止不动,系统仅会以动画形式循环播放彩色安全动画。
如需为卡券启用安全动画,请在卡券类中将 SecurityAnimation
字段的 AnimationType
设置为 FOIL_SHIMMER
。
请参见下面的图 1,查看启用安全动画后如何显示安全动画的示例:
图 1.
使用屏幕锁定功能提供保护
为了保护客户对卡券的访问权限,您可以要求客户在每次添加或访问卡券时设置屏幕锁定。可以通过设置 class.viewUnlockRequirement
来完成此操作。如需了解详情,请参阅 ViewUnlockRequirement
类型。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-02-28。
[null,null,["最后更新时间 (UTC):2025-02-28。"],[[["Passes can be redeemed by customers using either NFC tap or barcode scan."],["Rotating barcodes and security animations enhance security by mitigating risks like ticket theft and unauthorized resale."],["Passes can be further protected by requiring a screen lock for access, using the `class.viewUnlockRequirement` setting."],["Developers can find detailed information about various features and settings through the provided links to the Google Pay API documentation."],["Smart Tap enables seamless redemption and merchants can sign up for it through the provided support link."]]],["Passes can be redeemed via NFC tap or barcode scan. Barcodes can be static or rotating for enhanced security, changing periodically to prevent unauthorized use. Another security measure, the security animation, displays a shimmering outline around the barcode that triggers upon device motion. Additional security can be set via screen lock to control access to the pass. To set the barcode, use object.barcode or object.rotatingBarcode and for security animation use class.viewUnlockRequirement.\n"]]