更新日期:2022-05-09Google谷歌支付帮助文档
Follow 海外 SDK 客户端、服务端开发文档进行接入。
谷歌后台配置文档链接:https://www.quicksdk.com/doc-516.html
1、开发者账号:
Google 后台配置需要申请一个 google 开发者账号,并且绑定一张可用的双币银行卡 (开通成功之后会扣费 25 美元)。
2、测谷歌支付需上传 apk 至 Google Play Console 后台
上传版本需注意:
A、客户端传入的商品 id、商品价格、商品名称和后台一致
B、上传的 apk 版本号需要和测试的 apk 保持一致
C、传入的商品价格为美元(google 会根据国家定位来计算汇率,显示不同国家 相对应的商品价格)
D、如果测试的版本为非开放的,需要将 google 测试账号加入到测试列表里面。
Tips:如果上传包体至谷歌报错如下,需要在 sdk 目录下 build-tools,命令行 zipalign -f -v 4 infile.apk outfile.apk,将优化后的 apk 上传至 google 后 台,发布相对于版本,比如测试时可以发布 alpha 版本。用工程可以测,自己下 载链接也可以测,将版本链接如下用手机浏览器打开,就可以下载至手机并安装 了。
3、进行测试之前,确保 Google Play 账号能正常支付
打开 Google Play 查看是否能看到付费的商品,如果能看到,则次账号能够正常 使用并且付费。
2、报错无法购买(如下图):
或者提示:Error checking for billing v3 support. (response: 3:Billing Unavailable)
解决办法:禁止所有GP定位,清除GP应用缓存,再开VPN和GooglePlay商店,登录可用的账号,查看Google Play里面是否能看到付费游戏,如果看不到付费游戏,则表示账号不可用支付。
注意:这一步还没有走到服务端请求,主要从环境和账号两方向来排查。
3、如果支付时提示:Billing service unavailable on device.(response:3:Billing Unavailable)
请检查:后台(GP后台、SDK后台)是否配置商品;是否在谷歌后台上传apk;测试账号是否加入测试列表。
4、支付时提示(401)The current user has insufficient permissions to perform the requested operation
请检查:
A.谷歌后台是否设置服务账号及分配权限。
B.包体的包名、版本号是否和后台配置一致,客户端初始化接口传入的产品ID是否正确。
注意:如果是新建的gp服务账号,旧的gp服务账号可能有个缓存,新的服务账号生效有个等待时间。
5、支付成功之后提示AsyRequestFail
支付成功,通知游戏发货失败。查看后台订单状态,服务端技术检查是否收到请求,校验是否正确等。
6、支付提示该版本没有配置对应谷歌支付,如下:
请检查几项:
A、是否成功发布版本
B、安装的版本是否与后台配置的版本一致。
C、安装与上传的apk是否是Release版本(不能是Debug版本),是否有签名。
7、无法购买您要买的商品
检查:
A.测试账号有没有加入到测试列表(如确认有加入,则检查看下手机上是不是有多个谷歌账号,把其他的谷歌账户都退出,只保留一个加入测试计划的)。
B.客户端、SDK后台、谷歌后台三方的商品id、商品价格是否一致。
8、如果提示“支付失败:get orderId failed.”,如图:
请检查是否已在后台(谷歌后台、SDK后台)正确配置商品:商品id、商品价格
9、提示“我们这边出了点问题”,如图:
a. 请检查是否账号被封,游戏下架。
b. 清理一下手机上 gp 商店、gp 服务等组件缓存,再打开 gp,重进游戏进行尝试
10、无法弹出购买界面时,如果报错日志:
GPHelper: Purchase finished: IabResult: Null data in IAB result (response: -1002:Bad response received), purchase: null
这个报错是手机系统默认的把google Play从后台弹出弹窗的功能关闭了,所以不会出现支付小弹窗,打开google play的“允许应用在后台弹出界面”即可。
11、日志显示:{"result":false,"data":[],"error":{"id":50001,"message":"創建訂 單失敗,請重試"}}
这个报错为游戏没配置对应的商品 id。CP 需确保客户端、SDK 后台、谷歌 后台的商品 id、商品价格一致。
12、其他服务端报错
12.1. Not a valid email or user ID
此错误为服务账号配置的不正确,当前账号没有存在于 google 后台。
12.2. Open Authentication Errors
invalid_grant
1. Your server’s clock is not in sync with NTP. (Solution: check the server time if its incorrect fix it. )
2. The refresh token limit has been exceeded. (Solution: Nothing you can do they cant have more refresh tokens in use) Applications can request multiple refresh tokens. For example, this is useful in situations where a user wants to install an application on multiple machines. In this case, two refresh tokens are required, one for each installation. When the number of refresh tokens exceeds the limit, older tokens become invalid. If the application attempts to use an invalidated refresh token, an invalid_grant error response is returned. The limit for each unique pair of OAuth 2.0 client and is 25 refresh tokens (note that this limit is subject to change). If the application continues to request refresh tokens for the same Client/Account pair, once the 26th token is issued, the 1st refresh token that was previously issued will become invalid. The 27th requested refresh token would invalidate the 2nd previously issued token and so on.
12.3. invalid_client
Make sure that you have both product name and an email address set up in Google Apis Console
12.4. subscriptions are in a suspended state
[412] Errors [ Message[You cannot sign up for Google Apps because one or more of your subscriptions are in a suspended state.]
Solution: Check Google developers console and check your billing options. I think either your credit card has expired or you forgot to pay your bill.
Your account is suspended so you cant make any requests.
Links to question on SO: Subscriptions are in a suspended State error
12.5. invalid_grant: Invalid JWT
{ “error”: “invalid_grant”, “error_description”: “Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values and use a clock with skew to account for clock differences between systems.” }
Your server’s clock is not in sync with NTP. (Solution: check the server time if its incorrect fix it. )
12.6. invalid_grant: Code was already redeemed
This error requires a little explanation. When the user clicks authenticate you are given an authentication code. You take this code and exchange it for your access token and refresh token.
invalid_grant: Code was already redeemed
Means that you are taking an authentication code that has already been used and trying to get another access token / refresh token for it. Authentication code can only be used once and they do expire so they need to be used quickly.
12.7. Invalid_grant: bad request
Normally means that the client id and secrete you are using to refresh the access token. Was not the one that was use to create the refresh token you are using.
Try and authenticate again get a new refresh token.
{“error”: “invalid_grant”, “error_description”: “Bad Request”}
12.8. Storagerelay URI is not allowed for ‘NATIVE’ client type
The following error can occur if you are using a native type client id on a javascript application. You should be using a Browser type.
400. That’s an error.
Error: invalid_request
Storagerelay URI is not allowed for ‘NATIVE’ client type.
Request Details
That’s all we know.
另附谷歌相关文档:
李先生:13880511661
QQ:48157910
赵先生:15390049857
QQ:1077535763
孙女士:13551010407
QQ:1799614139
QQ群:698731538