支持 UPI 的 Android 二维码扫描器
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Android 13(向后兼容 Android 12)通过添加专用二维码扫描器(用户可以直接从相应的快捷设置功能块访问)来支持 UPI 付款流程。用户可以通过扫描实时摄像头或静态图片中的二维码来启动 UPI 付款流程。

当设备上安装多个 UPI 应用时,系统会向用户显示一个消除歧义对话框。然后,付款流程会在用户选择的应用中继续。
请注意,应用的顺序不会以任何方式修改。操作系统会优先显示用户最常用的应用,这与现有的 UPI intent 对话框类似。
支持 Android 二维码扫描器中的 UPI intent
通过此流程启动付款应用时,调用软件包 ID 会设为 com.google.android.gms。此值无法更改。
付款应用需要验证此来源,并将通过此软件包 ID 发起的所有付款流程视为由二维码发起,并在向收款方的 PSP 发送数据时将发起模式设为二维码。
为了区分是通过扫描实时二维码(使用相机)还是扫描二维码图片(设备上的照片)发起的付款,二维码扫描器会传递 intent extra,以帮助识别二维码的来源。
付款应用需要使用键 com.google.android.gms.UPI_QR_SOURCE
提取“intent extra”的值,然后与以下内容进行比较:
STATIC_IMAGE
字符串表示来源是静态图片。
LIVE_CAMERA
字符串表示来源是相机。
键 |
值 |
说明 |
com.google.android.gms.UPI_QR_SOURCE |
STATIC_IMAGE
|
存储在设备上的二维码图片。 |
|
LIVE_CAMERA
|
使用相机实时拍摄的二维码图片 |
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Android QR scanner with UPI support\n\nAndroid 13 (with backwards compatibility for Android 12) supports UPI\npayment flows by adding a dedicated QR Code scanner that users can access\ndirectly from the corresponding Quick Settings tile. Users can launch\na UPI payment flow by scanning a QR Code either from the live camera or from\na static image.\n\n\nWhen multiple UPI apps are installed on a device, the user is presented\nwith a disambiguation dialog. The payment flow then continues in the app\nselected by the user.\n\nNote that the order of apps is not modified in any manner. Users' most\nfrequently used apps are prioritized by the OS and displayed first, similar to\nthe existing UPI intent dialog.\n\nSupport UPI intents from Android QR scanner\n-------------------------------------------\n\nWhen a payment app is launched via this flow, the calling package ID is set\nas **com.google.android.gms**. This value cannot be altered.\n\nPayment apps need to **verify this source** and handle all the payment\nflows initiated from this package ID to be **treated as initiated by QR** and\n**set the initiation mode to QR when sending data to the payee's PSP**.\n\nTo distinguish between payments initiated from scanning a live QR Code (using\nthe camera) and scanning a QR Code image (photo on device), the QR scanner\npasses an intent **extra** which helps identify the source of the QR Code.\n\nPayment apps need to fetch the value of \"intent **extra** \" with the key\n`com.google.android.gms.UPI_QR_SOURCE`, and then compare with the following:\n\n- `STATIC_IMAGE` string indicates that the source is a static image.\n- `LIVE_CAMERA` string indicates that the source is the camera.\n\n|--------------------------------------|----------------|----------------------------------------------|\n| **Key** | **Value** | **Explanation** |\n| com.google.android.gms.UPI_QR_SOURCE | `STATIC_IMAGE` | QR code image stored on the device. |\n| | `LIVE_CAMERA` | QR code image captured live using the camera |"]]