google pay(谷歌支付) 开发者账号配置的坑

背景

因为最近要引入新项目,需要介入一个新app的Google支付。所以需要配置一些信息,我看了我们之前java的代码,发现目前校验GooglePay支付参数得时候,java只需要4个信息:
1、ServiceAccountId
2、ServiceAccountPrivateKeyFromP12File
3、ApplicationName
4、GoogleAppPackageName
第3、4个信息比较好找就是app的包名和app名字。这里就略过了。

ServiceAccountId

进入谷歌云平台,https://console.cloud.google.com/ 创建项目,这里就不详细说了,略过。
选择左边的菜单-API和服务-凭据
在这里插入图片描述
到服务账号栏-管理服务账号,进入下图。创建服务账号,我这里创建过了,就不演示了。ServiceAccountId即为电子邮箱地址
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210618175345567.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,t在这里插入图片描述

ServiceAccountPrivateKeyFromP12File

创建好服务账号以后,进入服务账号,选择密钥-创建新密钥-选择p12。创建好了以后,将p12的文件保存到服务器,然后代码里面直接获取就可以了。
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

踩坑

1、403:projectNotLinked。The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.

{
 "error": {
  "errors": [
   {
    "domain": "androidpublisher",
    "reason": "projectNotLinked",
    "message": "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console."
   }
  ],
  "code": 403,
  "message": "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console."
 }
}

出现403的原因是因为服务账号和app没有绑定关系导致。
解决办法:
登录https://play.google.com/console/developers谷歌的开发者平台,登录,选择设置,然后选择服务账号这一栏,看是否有自己配置的服务账号。
在这里插入图片描述
如果没有,检查关联的项目是否为自己刚刚创建的项目。
在这里插入图片描述
如果有服务账号,则授权服务账号。如果是做支付,则一定要勾选财务的模块,同时邀请账号进来,设置账号权限。即可
在这里插入图片描述
2、401:permissionDenied。The current user has insufficient permissions to perform the requested operation.

{
  "code" : 401,
  "errors" : [ {
    "domain" : "androidpublisher",
    "message" : "The current user has insufficient permissions to perform the requested operation.",
    "reason" : "permissionDenied"
  } ],
  "message" : "The current user has insufficient permissions to perform the requested operation."
}

401原因是因为我解决403问题的时候,重新配置了权限。google以后发现,需要重新保存应用内产品,即可解决此问题。
在google play控制台中,选择自己的app,进入应用内,下来菜单栏,找到应用内商品,进入应用内商品-修改商品说明或者商品名称,保存。即可

应用内

  • 4
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值