相关疑难解决方法(0)

我是否正确地验证了用户的Android应用内订阅?

我正在制作一个不需要用户帐户/登录的应用程序,并允许用户购买订阅.我想使用Google Play Developer API来验证用户是否有购买/有效订阅.从所有文档中,我收集了以下步骤.

它们是否正确,您能否回答其中的两个问题?

  1. 在Google API控制台中创建服务帐户.
  2. 保存给我的私钥(其中?肯定不在我的代码/设备上,如此示例代码所示)
  3. 使用Google API Client Library for Java使用私钥创建和签署JWT(文档如何给我这个,但这不是Java代码......我该怎么办?)
  4. 构造访问令牌请求,并获得对API的访问权限
  5. 应用程序现在可以向API 发送GET请求,以确定用户是否具有订阅
  6. 当访问令牌过期时,请返回步骤3.

此外,我有一个Web服务,虽然我对Web服务或Web服务编程一无所知......我只知道它可能需要在这里使用.

编辑:这些步骤不正确.请参阅下面的答案,了解正确的步骤.但请注意,这仅适用于使用服务帐户(因为我不想要求用户必须明确允许API访问)

service android google-api subscription google-play

30
推荐指数
4
解决办法
2万
查看次数

AndroidPublisher API返回projectNotLinked错误

当我在Google Developers Console中使用Google Play Android Developer API测试购买产品的状态时,会发生这种情况,结果总是如此

{
 "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."
 }
}
Run Code Online (Sandbox Code Playgroud)

使用另一个开发者帐户(和包名称)检查了这一点,它工作得很好.我确定已将Google开发者控制台的API项目与Google Play开发者控制台 - > API访问设置相关联,并尝试尽可能多地重新创建,但没有任何项目有效.

那我在这里错过了什么?除了我在Google Play控制台设置中制作的链接项目外,它的含义是什么"无法链接".

android google-play

17
推荐指数
4
解决办法
8764
查看次数

从Firebase Functions调用Google Play Developer API

我想发展我的用户的应用内购买和订阅的服务器端验证的建议,我想用火力地堡功能为.基本上它必须是一个HTTP触发器函数,它接收购买令牌,调用Play Developer API来验证购买,然后对结果做一些事情.

但是,调用许多Google API(包括Play Developer API)需要进行非平凡的授权.以下是我理解所需设置的方法:

  1. 必须有一个启用了Google Play Developer API v2的GCP项目.
  2. 它应该是一个单独的项目,因为在Google Play控制台中只能有一个链接到Play商店.
  3. 我的Firebase Functions项目必须以某种方式对该其他项目进行身份验证.我认为使用服务帐户最适合此服务器到服务器方案.
  4. 最后,我的Firebase函数代码必须以某种方式获取身份验证令牌(希望是JWT?),最后进行API调用以获得订阅状态.

问题是绝对没有人类可读的文档或指导.鉴于Firebase中的入口流量包含在免费计划中(因此我假设他们鼓励使用Firebase功能中的Google API),这一事实非常令人失望.我已经设法在这里和那里找到一些信息,但是对于谷歌API的经验太少(大多数只需要使用api密钥),我需要帮助将它放在一起.

这是我到目前为止所发现的:

  1. 我有一个链接到Play商店并启用了API的GCP项目.但出于某种原因,尝试在API资源管理器中对其进行测试会导致错误"用于调用Google Play Developer API的项目ID尚未在Google Play开发者控制台中进行链接".
  2. 我创建了一个服务帐户并导出了一个JSON密钥,其中包含生成JWT的密钥.
  3. 我还在Play Console中为该服务帐户设置了读取权限.
  4. 我找到了一个用于Google API 的Node.JS客户端库,它是alpha版本并且文档非常稀疏(例如,没有关于如何使用JWT进行身份验证的明显文档,也没有关于如何调用android发布者API的示例).目前我正在努力解决这个问题.不幸的是,我对阅读JS库代码感到不太舒服,特别是当编辑器没有提供跳转到突出显示的函数源的可能性时.

我很惊讶没有被询问或记录,因为从Firebase功能验证应用内购买似乎是一项常见任务.有没有人成功完成它,或者Firebase团队可能会介入回答?

google-api firebase google-api-nodejs-client google-play-developer-api google-cloud-functions

13
推荐指数
1
解决办法
2209
查看次数

获取android订阅状态,403失败

在尝试获取Android应用内订阅状态(有效期限)时,我收到以下错误消息:

{
 "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."
 }
}
Run Code Online (Sandbox Code Playgroud)

该网址为:https://www.googleapis.com/androidpublisher/v2/applications/[packageName]/inapp/ [productId]/purchases/[purchase_token]?access_token=[access_token]

它说项目ID没有链接.我做了以下事情:

1. Create the project in Google Developer Console.
2. …
Run Code Online (Sandbox Code Playgroud)

android google-api subscription in-app

10
推荐指数
2
解决办法
1万
查看次数

在Google API v2中,为什么会出现错误"用于调用Google Play Developer API的项目ID尚未链接"?

当我使用Google API v2时,为了获得一个inapp列表,我在进行API调用时遇到以下错误:

{
 "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."
 }
}
Run Code Online (Sandbox Code Playgroud)

然后我研究了这个错误,最后看到了这个页面,这个页面以及这个页面上的建议.我跟着并仔细检查了项目在那里的链接方式,但没有帮助.

这就是我做的......

在Google Developer Console中:

  1. 使用现有项目.
  2. 去了API&auth> API.
  3. 确保"Google …

php google-api google-play google-api-php-client

7
推荐指数
1
解决办法
7404
查看次数

403 错误:用于调用 Google Play Developer API 的项目 ID 尚未在 Google Play Developer Console 中链接

我正在使用 Google Play Developer Console 帐户的 v2。

我转到在线 API 资源管理器进行新的编辑。

我在packageName字段中输入我的包名称 (com.companyname.appname) ,点击“执行”,然后收到此403错误响应:

{
 "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."
 }
}
Run Code Online (Sandbox Code Playgroud)

我实际上确实链接了我的 …

android google-api google-play

5
推荐指数
1
解决办法
6574
查看次数

如何在Android中通过客户端获取订阅的到期日期?

我们正在使用Android中的应用内购买来实现订阅,我们正在获得购买时间戳,格式如下

'{
   "orderId":"GPA.1234-5678-9012-34567",
   "packageName":"com.example.app",
   "productId":"exampleSku",
   "purchaseTime":1345678900000,
   "purchaseState":0,
   "developerPayload":"bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ",
   "purchaseToken":"opaque-token-up-to-1000-characters"
 }'
Run Code Online (Sandbox Code Playgroud)

但是我们需要在应用程序UI中显示到期日期,我们想从Play商店获取确切的到期日期。我们假设,如果我们手动计算有效期限,则可能与Play商店的有效期限发生冲突。谁能解释“如何在Android中获取订阅的到期日期?”

android subscription in-app-purchase auto-renewing android-studio

5
推荐指数
1
解决办法
2231
查看次数

“ message”:“用于调用Google Play开发人员API的项目ID尚未在Google Play开发人员控制台中链接。”

我正在尝试使用以下API下载针对Android Apps的评论。 https://developers.google.com/android-publisher/api-ref/reviews

但这需要身份验证。因此,我按照上面链接中链接的说明进行操作。

我能够获得访问令牌。

但是我得到以下回应:

{
 "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."
 }
}
Run Code Online (Sandbox Code Playgroud)

我看到其他一些帖子说,您必须将其与Google Play开发者控制台关联。所以我做到了(见下图)。

[Google Play控制台,链接的项目]

但是我仍然收到此错误。请帮忙。

google-api google-api-client google-console-developer google-play-developer-api google-developers-console

5
推荐指数
2
解决办法
3015
查看次数