Marketplace integration: Google
This tutorial shows you how to successfully integrate a Google Play application into your title in Game Manager.
Prerequisites
- A Google Account.
- An app already created and available in Google Play.
- Make sure your app has the Google Play Android Developer API enabled.
- Access to Google Cloud.
- An existing Google Cloud project.
Step 1: Create a service account
The first step you need to complete is creating a service account. This is done through the Google Cloud Platform (GCP).
From the top navigation bar, select the menu button on the top left corner.
Select IAM & Admin, then Service Accounts.
From the top of the page, select Create Service Account.
Fill out the service account details, then select Create and Continue.
Grant access to the new service account from the Select a role dropdown options by looking for Service Account User.
Press Done (you can skip the Grant users access to this service account step).
Once the Service Account is created, you're directed back to the Service Accounts page that shows a list of all the service accounts under the specified project.
Add permissions to an existing service account
This substep intends to show you how to add the project permissions to an existing Service Account, or if you missed adding the permissions when creating an account.
Go into the IAM & Admin section in GCP from the top left navbar menu.
Select Grant Access from the start of the list of Service Accounts.
Select the desired service account in the New principals box. It searches for your Service Account title through all existing service accounts in the project, prompting you to select the specific option corresponding to the desired service account.
Assign the Service Account User role by searching for it in the Select a role dropdown.
Press Save.
Step 2: Get account credentials
Once you have your Service Account created and available, the next step is to get a JSON file that contains your Private Key (Credentials) which are to be added to your Title in Game Manager. To do this, follow the next steps:
From GCP, open the left navbar menu and under IAM & Admin choose Service Accounts.
This loads the list of all service accounts under the current project. Look for the one you want to get credentials from and select it. (In this case, our service account is called Integration Test, hence it shows up as "integration-test@.....").
You're shown a screen with your service account details alongside tabs on the upper part of the screen, select the Keys tab.
Select Add Key > Create new key.
Select JSON as your Key type and press Create.
This downloads a .json file to your computer. Open it and make sure you have the Private Key.
Note
Ensure you properly and securely save that JSON file to protect your data, you will need to use it later in this tutorial.
Step 3: Link to Google Play Console
It's time to move on to the Google Play Console to link your newly created credentials with your game.
Note
This step assumes you have completed the prerequisite of already having an app created and ready in the Google Play Console. If you don't have it, this is the time to create it.
Open the Google Play Console.
From the left navigation menu, select Users and permissions.
On the right-hand side of the screen, select Invite new users.
In the Email address field, add the email address of your service account from GCP. It should look something like this:
integration-test@iapandroid-151919.iam.gserviceaccount.com
.You see some tabs in the Permissions section, the App permissions should be selected by default. Select the Add app option.
From the list of apps, choose the one you want your account to be linked to. In this case, it's Economy V2 Playfab Test App. Once selected, press Apply.
A window pops up asking you to specify the type of permissions you want to give that account in your app. Choose Manage orders and subscriptions under Financial data and then press Apply.
You're redirected to the Invite user screen again (where you added the account's email address and set the app permissions). But this time, you should press Invite user at the bottom right of the screen. Then press the Send invite confirmation message.
Once the invite was sent, you're able to see your service account under the Users list in the Users and permissions screen.
Step 4: Link to PlayFab through Game Manager
Now that your service account was created in Google Cloud Platform and successfully linked to your app in the Google Play Console. It's time to link it to your studio and your game in PlayFab's Game Manager.
Open Game Manager and select your Title.
Once inside your Title screen, select the Add-ons option from the left navigation menu.
Search for and select the Google option.
On the right side of the screen, select Install Google, which displays a set of information you must include before completing the integration.
For the Google App package ID you should use one from the Google Play Console, in our case it's:
com.playfab.economy
, the rest of the fields for this example are optional. The only other required field is the Service Account Key field, in which you should paste the contents of the JSON file gotten from the Google Cloud Platform.Press Install Google. This validates the data you input in the previous step and you notice that the service account key was simplified and just shows the Private Key Id.