Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
设置 Google Pay API
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
开始前须知
为了让您的应用做好准备,请完成以下部分中的步骤。
应用前提条件
如需在 Android 上使用 Google Pay API,您的应用必须满足以下条件:
- 通过 Google Play 商店分发。
- 使用以下配置构建:
minSdkVersion 为 23 或更高版本
compileSdkVersion 为 34 或更高版本
要配置您的应用,请完成以下部分中的步骤。
应用依赖项
将 Google Pay API 的 Google Play 服务依赖项添加到模块的 Gradle build 文件(通常为 app/build.gradle 或 app/build.gradle.kts)中:
Groovy
dependencies {
implementation 'com.google.android.gms:play-services-wallet:20.0.0'
}
Kotlin
dependencies {
implementation("com.google.android.gms:play-services-wallet:20.0.0")
}
准备好上线后,请参阅发布集成,了解重要信息。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2026-05-01。
[null,null,["最后更新时间 (UTC):2026-05-01。"],[],["To utilize the Google Pay API, ensure your app is on the Google Play store and meets `minSdkVersion` 21 and `compileSdkVersion` 34 or higher. Install the Google Wallet app with a payment method. If Google processes payments or you sell digital goods, use Google Play In-app Billing. Add the `com.google.android.gms:play-services-wallet:19.4.0` dependency to your module's Gradle file. In your `AndroidManifest.xml`, enable the API with the `meta-data` element: `com.google.android.gms.wallet.api.enabled` with a value of `true`.\n"]]