技术中心

Google Play Developer API: How to Create a Service Account

2022年5月4日

张贴者:Rahul Upadhyay

Google Play Developer API: How to Create a Service Account

我为什么要读这篇文章?

  • Mobile applications are surrounded by so many modules in addition to that, the IN-APP Purchase and Subscriptions play a good amount of role, 作为应用程序的所有者,你在哪里, can generate revenue by selling consumable and non-consumable goods such as Coins for Games, 应用程序的订阅计划有很多.  
  • 现在, 当你在应用上销售一些商品时, there must be a way to validate that purchase or get the details. But obviously, you can do it from the app itself as Google does provide SDK for the same. (SDK -软件开发工具包). But, we are living in a world where 安卓 and iOS exist and are in a very competitive market!  
  • Google Play Developer API gives us the power to check the user’s transaction from the RESTful APIs which leads you to read this blog.  
  • 使用RESTful API, we can do this call from the BACKEND and leave the app standalone and do other stuff 

提供

Google Play Developer API lets you manage the 2 main components in your project 

  1. The Publishing API lets you upload and publish apps, and perform other publishing-related tasks.
  2. 订阅和应用内购买API 让你管理应用内购买和订阅. [我们将探讨这些api]

客观的 

To verify the Google In-App Purchase and Subscriptions (IAP) 

需求 
  1. Google Play开发者控制台访问
  2. 谷歌云控制台访问
注意:要开始进行API调用, you will set up and manage the Google Play Developer API directly from the Google Play Console. The API can be managed by the Google Play Developer Account owner.  

Tip: If you already have an existing project over 谷歌云 Console then it should be using the same 谷歌 account you used for the Google Play Console. If you have a different account setup then there are specific steps and roles with which we can achieve this. 

 以下是我们关注的主要步骤:  

  1. 设置一个新的或现有的Google cloud项目
  2. User, a service account to access the Google Play Developer API
  3. 访问RESTful api来分析应用程序

让我们开始

链接您的帐户和项目

才能访问Google Play Developer API, you must link your Google Play Developer Account to a 谷歌云 Project. 在大多数情况下, we recommend that you create a new 谷歌云 Project dedicated to your Google Play Developer Account, 但是您可以链接一个现有的项目. Keep in mind that each Google Play Developer Account can only be linked to a single 谷歌云 Project. If you have multiple apps in the same Google Play Developer Account, 它们都必须共享同一个谷歌云 Project. 

访问Google Play开发者控制台
  1. 登录Google Play开发者控制台 Play Console (谷歌).com)
  2. 选择您的帐户  
  3. On the side navigation menu, select Setup>AP Access 
     
  4. Agree with API terms of service (Just follow on-screen instructions if any).   
  5. Once done, you will be seeing options to link your existing project or create a new project.
  6. If you already have a 谷歌云 Project then you can Link that project or you can create a new project.
    1. 链接现有项目
      1. Select the existing project by clicking on Choose Project dropdown menu If your project isn’t listed, verify that your Google Play Console account is with the role OWNER and Google Play Developer API is enabled for the project. 如果没有,电竞赛事竞猜APP按照下面的方法快速完成, 怎么做?? 
        1. 选择项目并单击SAVE按钮  
        2. 你会看到这样的页面. 我们需要处理服务帐户部分. If you already have a service account then you will be seeing it listed. 如果没有,那么我们将创建一个新的服务帐户.  
    2. 创建新项目
      1. Select the option 创建新项目 and click the SAVE button 
        1. A new project will be created and you can see that project below
        2. We can edit the project name later from the Google Developer Console. 

配置服务帐号

Most common secure software service which will access the API.  

Service accounts must be used in a secure environment, such as your server. The service account credentials need to be securely managed so they are not revealed to anyone that is not authorized to use the API. 

Once we have project linked or created, our main goal is to 创建新的服务帐户 或者允许访问已经创建的服务帐户.  

  1. 创建一个新的服务帐户
    1. Read the instruction once you click this button, "CREATE NEW SERVICE ACCOUNT"
    2. Click on the option #1, Go to the 谷歌云 Platform and open that URL in the new 选项卡 
    3. 现在,你在谷歌控制台
    4. Click on the CREATE SERVICE ACCOUNT and follow the next step
       
    5. 命名您的服务帐户并提供描述. 不需要修改第二个字段
    6. 点击CREATE AND CONTINUE. 这里我们需要将ROLE配置为这个服务帐户
    7. Search for Service Account Admin and click on the role
    8. 选中后,单击CONTINUE
    9. We are not doing anything in the 3rd step, just click DONE
    10. Your service account has been created and listed on the same page
    11. 选择该帐户并切换到键” 选项卡. We are going to add a new key to this service account.   
    12. 单击ADD KEY并选择CREATE NEW KEY  
    13. 选择Key类型为JSON并单击CREATE
    14. The key will be created and will ask you to download it. 按原样保存文件. We will need this for the development and ask you to provide that. 关闭此对话框.
    15. 您可以在页面上看到创建的密钥列表
  2. 授予对服务帐户的访问权限
    1. 现在,回到PLAY控制台页面,#7.本文档中的A. 点击完成. You will see the newly created service account under the SERVICE ACCOUNTS section
    2. Click on the GRANT ACCESS (from step 8) and you will be seeing the following screen
    3. 勾选这两个框,点击邀请用户
       
      在确认框中选择SEND invite 
    4. Once done, you will see this screen with the new service account added as a User. 如果没有,请 启用Google Play Developer API

启用Google Play Developer API

Need to enable Google Play Developer API from the 谷歌云 Console. Open the 谷歌云 Console which you already have opened in the step 创建一个新的服务帐户#c

  1. 单击Hamburger菜单,选择api & 服务 > Library
  2. Search for "Google Play 安卓 Developer API" and click the 搜索ed result
     
  3. 启用此API. 一旦启用了
  4. Once done you will be able to see the Service Account listed in step 授予对服务帐户#d的访问权限

Hope you have fun reading this blog and heading towards getting a coffee. 愉快的安排. Let me know your thoughts, and questions in the comments section below. 

谢谢你!. 

引用:

分享这


回来

按类别分类的帖子