*

Store Integration – Google

In this tutorial we’ll look at integrating the Google Play store with the brainCloud marketplace. By doing this, Google Android users will have the ability to validate purchased items from the Google Play store with brainCloud.

Note that apps still have to make the purchase directly with the Google Play Store. For more information on this process refer to the Google Play developer site.

Purchase Flow

(coming soon)

 

brainCloud Portal Setup

Here are the steps to configure brainCloud for Google Play purchases.

Prerequisites

  • You should have setup your products in the brainCloud marketplace. Please refer to the Marketplace Configuration guide.
  • You should have created the Google Store In-App products per the Google Developer documentation

Associate Google In-App Products with brainCloud Products

After setting up your products in the brainCloud marketplace, you’ll want to associate them with the Google product ids. In particular we will be grabbing the product ids from the Google Play developer site and entering them into the appropriate brainCloud products.

    • Log into the Google Play Developer site
    • Select your App and go to the “In-App Products” section
    • Select your IAP and grab the Google Product ID
      brainCloud

(for this tutorial we’ll assume that the product id is com.braincloud.mygame.goldsack1)

  • Log into the brainCloud Portal
  • Go to the “Marketplace | Products” page in the Design tab
    brainCloud
  • Select the product you would like to associate.
    brainCloud

 

 

 

  • Click the “+ Edit Product” button
    brainCloud

 

 

 

  • Find your Price (or create one) and click the edit icon
    brainCloud

 

 

 

  • In the Edit Price dialog, click the + icon to add an entry for Google
    brainCloud

 

 

 

  • Enter your Google product id for this price – in our case “com.braincloud.mytestapp.goldsack1”.
    brainCloud

 

 

 

  • At this point you may want to select your price to be the default if it isn’t already selected. You can do this back in the Edit Product page.
    brainCloud

 

 

 

  • You can now verify that your Product is coming back with the correct Google In-app Product id. Here is the output from the API Explorer “Product.GetInventory” call using “googlePlay” as the platform:
    brainCloud

 

 

Google Certificates and Credentials

Once the products have been configured, you will need to add the appropriate Google credentials to brainCloud.

  • Navigate to the Application IDs page
    brainCloud
  • Click the Google icon and notice the following fields
    brainCloud
  • The following sections will show you where to find the appropriate information

Google Package Name

  • Log into the Google Play developer site
  • Select your application
  • Grab the package name
    2015-12-04_13-38-45

Google Service Account Email & p12 Certificate File

To validate purchases, brainCloud requires usage of a Service Account to communicate with the Google Play backend servers.

  • Log into the Google Console developer site
  • Create a project (or select an existing project). Note that the Google Service Account can be used across multiple apps.
    2015-12-04_14-05-20
  • Enable the Google Play Android Developer API
    brainCloud
  • Navigate to the Credentials page
    2015-12-04_14-22-14
  • Create a new Service Account
    2015-12-04_14-26-28
  • Select the p12 key type and click Create
    2015-12-04_14-28-02
  • This should create a new Service Account and immediately download the p12 key file to your computer. If for some reason the browser did not download the p12 key file try Chrome.
  • Upload the p12 key file to the brainCloud portal.
  • Also the Service Account should now show up on the Credentials page. Important: Grab the email address and save it to the brainCloud portal – Design | Core App Info | Application IDs, Google platform tab, Google Service Account Email field.
    2015-12-04_14-31-03

Linking the Google Console project to the Google Play app

For the Service Account to be active, you will need to link the console project to the Google Play app and give the Service Account permission to View Financial Reports. Note you will need to be the account owner in order to complete these steps.

  • Log into the Google Play Developer Console
  • Go to Settings | API Access
    2015-12-04_14-35-03
  • Select the Google Console project to link to
  • Verify that the project is linked and the Games Services Publishing API access is ON
    2015-12-04_14-38-48
  • Next navigate to User accounts & rights
  • Select the Service Account and turn on “View Financial Reports” permission. All other permissions can be disabled
    brainCloud
  • You should now be able to validate purchase with brainCloud.