将会员卡添加到 Google 通过 Google Play 服务支付 API
Add loyalty card to Google Pay via Google Play Services API
我在使用 google 播放服务 api 将会员卡添加到 google 付费应用程序时遇到问题。我在 google 付款请求后获得了帐户验证,但我在日志中收到 400。
找不到问题...
下面的代码是按照本指南编写的:
https://developers.google.com/pay/passes/guides/overview/basics/typical-api-flow
附上代码(看评论,很重要)
// is 9999999
val userId : String = usr.idUser.toString()
// value is "John Snow"
val fullname : String = usr.fullname
// ISSUER_ID - is numeric value from console
val wob = LoyaltyWalletObject.newBuilder()
// the class id has similar name. All characters has been replaced with 'x' character
.setClassId("$ISSUER_ID.xxxx.xxx.xxxxxxxxxxxx.xxxxxxxxxx")
// similar to comment from method setClassId
.setId("$ISSUER_ID.xxxx.xxx.xxxxxxxxxxxx.xxxxxxxxxx.$userId")
.setState(WalletObjectsConstants.State.ACTIVE)
// id of user in app
.setAccountId(userId)
// name of user in app
.setAccountName(fullname)
// from console - "Issuer" = Loyalty
.setIssuerName("Loyalty")
// from console - "Program Name" = Loyalty card
.setProgramName("Loyalty card")
// barcode type from docs
.setBarcodeType("code128")
// card 16 digits card number
.setBarcodeValue("1234567890123456")
// formatter card number
.setBarcodeAlternateText("1234 5678 9012 3456")
// url on web resources
.addLinksModuleDataUris(uris)
.build()
val request = CreateWalletObjectsRequest.newBuilder()
.setLoyaltyWalletObject(wob)
.build()
val opts = Wallet.WalletOptions.Builder()
.setTheme(WalletConstants.THEME_LIGHT)
.setEnvironment(WalletConstants.ENVIRONMENT_PRODUCTION)
.build()
val client = Wallet.getWalletObjectsClient(activity, opts)
val task = client.createWalletObjects(request)
AutoResolveHelper.resolveTask(task,activity,UIRequestCode.RC_GPAY)
日志:
E: [13290] BasicNetwork.performRequest: Unexpected response code 400 for https://wallet.google.com/payments/apis/instantbuy/android/v1/createWalletObjects
E: Exception sending Volley request
java.util.concurrent.ExecutionException: com.android.volley.ClientError
at com.android.volley.toolbox.RequestFuture.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):4)
at com.android.volley.toolbox.RequestFuture.get(:com.google.android.gms@14574021@14.5.74 (040408-219897028):1)
at atew.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):29)
at atew.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):25)
at atyd.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):8)
at atxx.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):16)
at atof.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):4)
at atxw.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):4)
at atyg.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):2)
at atxq.a(Unknown Source:2)
at atxu.a(Unknown Source:19)
at xrb.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):3)
at cpb.onTransact(:com.google.android.gms@14574021@14.5.74 (040408-219897028):4)
at atxq.onTransact(:com.google.android.gms@14574021@14.5.74 (040408-219897028):1)
at android.os.Binder.transact(Binder.java:627)
at dry.onTransact(:com.google.android.gms@14574021@14.5.74 (040408-219897028):3)
at android.os.Binder.execTransact(Binder.java:697)
Caused by: com.android.volley.ClientError
at com.android.volley.toolbox.BasicNetwork.performRequest(:com.google.android.gms@14574021@14.5.74 (040408-219897028):49)
at qni.performRequest(:com.google.android.gms@14574021@14.5.74 (040408-219897028):13)
at com.android.volley.NetworkDispatcher.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):6)
at com.android.volley.NetworkDispatcher.run(:com.google.android.gms@14574021@14.5.74 (040408-219897028):2)
E: Unknown ServerResponse type=1
Github 问题:https://github.com/google-pay/s2gp-quickstart-android/issues/4(示例代码,通行证 API 尚未由 Google 通行证 API 团队更新的开发人员指南)
我也遇到了这个问题。错误消息不是很有用。 Google 支付团队需要将您的应用列入白名单。您需要通过 https://support.google.com/pay/merchants/contact/interest 联系他们并提供以下信息:
- 发卡行 ID(在您的商家帐户页面上)
- 应用程序包名称(可在您的 AndroidManifest.xml 清单父元素 com.companyname.appname 中找到)
- SHA1 指纹(可以按照此处概述的说明找到:https://developers.google.com/pay/passes/guides/get-started/basic-setup/native-android-sdk)
所以我终于让它工作了,在一般区域下的商家中心,我将状态字段从 DRAFT 更改为 UNDER_REVIEW。立马变成approved,我可以保存会员卡了。
Your app needs to be whitelisted by the Google Pay team.
Yes, is very important, but...
我已将我发布的 SHA1 指纹 (https://developers.google.com/pay/passes/guides/get-started/basic-setup/native-android-sdk) 发送给 Google 支付团队。之后,当直接从 apk 文件安装应用程序时,一切都开始正常工作(点击 "Add To GPay" -> 会员卡添加到 Google 支付)!
但是上传到 Play Market 时仍然无法正常工作(
经过艰苦的研究...)
解决方法:
SHA1 指纹需要从 "Google Play Console > Release Management > App Signing > App signing certificate"
获取
我在使用 google 播放服务 api 将会员卡添加到 google 付费应用程序时遇到问题。我在 google 付款请求后获得了帐户验证,但我在日志中收到 400。
找不到问题...
下面的代码是按照本指南编写的:
https://developers.google.com/pay/passes/guides/overview/basics/typical-api-flow
附上代码(看评论,很重要)
// is 9999999
val userId : String = usr.idUser.toString()
// value is "John Snow"
val fullname : String = usr.fullname
// ISSUER_ID - is numeric value from console
val wob = LoyaltyWalletObject.newBuilder()
// the class id has similar name. All characters has been replaced with 'x' character
.setClassId("$ISSUER_ID.xxxx.xxx.xxxxxxxxxxxx.xxxxxxxxxx")
// similar to comment from method setClassId
.setId("$ISSUER_ID.xxxx.xxx.xxxxxxxxxxxx.xxxxxxxxxx.$userId")
.setState(WalletObjectsConstants.State.ACTIVE)
// id of user in app
.setAccountId(userId)
// name of user in app
.setAccountName(fullname)
// from console - "Issuer" = Loyalty
.setIssuerName("Loyalty")
// from console - "Program Name" = Loyalty card
.setProgramName("Loyalty card")
// barcode type from docs
.setBarcodeType("code128")
// card 16 digits card number
.setBarcodeValue("1234567890123456")
// formatter card number
.setBarcodeAlternateText("1234 5678 9012 3456")
// url on web resources
.addLinksModuleDataUris(uris)
.build()
val request = CreateWalletObjectsRequest.newBuilder()
.setLoyaltyWalletObject(wob)
.build()
val opts = Wallet.WalletOptions.Builder()
.setTheme(WalletConstants.THEME_LIGHT)
.setEnvironment(WalletConstants.ENVIRONMENT_PRODUCTION)
.build()
val client = Wallet.getWalletObjectsClient(activity, opts)
val task = client.createWalletObjects(request)
AutoResolveHelper.resolveTask(task,activity,UIRequestCode.RC_GPAY)
日志:
E: [13290] BasicNetwork.performRequest: Unexpected response code 400 for https://wallet.google.com/payments/apis/instantbuy/android/v1/createWalletObjects
E: Exception sending Volley request
java.util.concurrent.ExecutionException: com.android.volley.ClientError
at com.android.volley.toolbox.RequestFuture.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):4)
at com.android.volley.toolbox.RequestFuture.get(:com.google.android.gms@14574021@14.5.74 (040408-219897028):1)
at atew.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):29)
at atew.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):25)
at atyd.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):8)
at atxx.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):16)
at atof.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):4)
at atxw.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):4)
at atyg.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):2)
at atxq.a(Unknown Source:2)
at atxu.a(Unknown Source:19)
at xrb.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):3)
at cpb.onTransact(:com.google.android.gms@14574021@14.5.74 (040408-219897028):4)
at atxq.onTransact(:com.google.android.gms@14574021@14.5.74 (040408-219897028):1)
at android.os.Binder.transact(Binder.java:627)
at dry.onTransact(:com.google.android.gms@14574021@14.5.74 (040408-219897028):3)
at android.os.Binder.execTransact(Binder.java:697)
Caused by: com.android.volley.ClientError
at com.android.volley.toolbox.BasicNetwork.performRequest(:com.google.android.gms@14574021@14.5.74 (040408-219897028):49)
at qni.performRequest(:com.google.android.gms@14574021@14.5.74 (040408-219897028):13)
at com.android.volley.NetworkDispatcher.a(:com.google.android.gms@14574021@14.5.74 (040408-219897028):6)
at com.android.volley.NetworkDispatcher.run(:com.google.android.gms@14574021@14.5.74 (040408-219897028):2)
E: Unknown ServerResponse type=1
Github 问题:https://github.com/google-pay/s2gp-quickstart-android/issues/4(示例代码,通行证 API 尚未由 Google 通行证 API 团队更新的开发人员指南)
我也遇到了这个问题。错误消息不是很有用。 Google 支付团队需要将您的应用列入白名单。您需要通过 https://support.google.com/pay/merchants/contact/interest 联系他们并提供以下信息:
- 发卡行 ID(在您的商家帐户页面上)
- 应用程序包名称(可在您的 AndroidManifest.xml 清单父元素 com.companyname.appname 中找到)
- SHA1 指纹(可以按照此处概述的说明找到:https://developers.google.com/pay/passes/guides/get-started/basic-setup/native-android-sdk)
所以我终于让它工作了,在一般区域下的商家中心,我将状态字段从 DRAFT 更改为 UNDER_REVIEW。立马变成approved,我可以保存会员卡了。
Your app needs to be whitelisted by the Google Pay team. Yes, is very important, but...
我已将我发布的 SHA1 指纹 (https://developers.google.com/pay/passes/guides/get-started/basic-setup/native-android-sdk) 发送给 Google 支付团队。之后,当直接从 apk 文件安装应用程序时,一切都开始正常工作(点击 "Add To GPay" -> 会员卡添加到 Google 支付)!
但是上传到 Play Market 时仍然无法正常工作(
经过艰苦的研究...)
解决方法: SHA1 指纹需要从 "Google Play Console > Release Management > App Signing > App signing certificate"
获取