# Google In-App Purchases with Conscent

<mark style="color:orange;">**Step 1. Enable the Google Developer and Reporting API**</mark>

1. **Access the Google API Console:** Open your browser and go to the Google API Console.
2. **Select Your Project:** Choose an existing project or create a new one.
3. **Enable the Required APIs:**
   1. Navigate to **Library** within the API Console.
   2. Search for and select the following APIs:
      1. **Google Play Android Developer API**
      2. **Google Play Developer Reporting API**
   3. Click **Enable** for each API.

**Note**: If the API is already enabled, you will see a **Manage** button instead.

4. **Set Up Credentials:**
   1. Once the APIs are enabled, you’ll be redirected to the API’s main page.
   2. If no credentials are set up, follow these steps to create them:
      1. Click on **Create Credentials**.
      2. Follow the on-screen prompts to generate the necessary credentials (OAuth 2.0, API keys, or service accounts) based on your project needs.
      3. Ensure that these credentials are created by the project owner or a user with the appropriate permissions.

**Important**: User permissions are defined in Step 3 of the Google Play Console and are required to access the Developer and Reporting APIs.

5. **Verify Permissions in Google Play Console:**
   1. Go to your **Google Play Console** and ensure the project owner or authorized user has the necessary permissions under **Settings > Permissions**.

<figure><img src="https://380225236-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcoDfVWiJBvgTq8DbifIH%2Fuploads%2FCJM7lBYhrtxuOmSm4JnT%2F281139973-97660d3a-b963-4b1e-8be0-d5bc28080b33%20(1).gif?alt=media&#x26;token=eb924906-2302-423c-9252-ede7c96c1f8b" alt=""><figcaption></figcaption></figure>

<mark style="color:orange;">**Step 2. Create a Service Account**</mark>

1. **Navigate to Service Accounts**
   1. Open the Google Cloud Console.
   2. Go to **IAM & Admin** > **Service Accounts**.
   3. Alternatively, if you're in the Google Play Console, you can reach this page from the last setup screen.
2. **Create the Service Account**
   1. Click **Create Service Account**.
   2. Enter a name for the service account (e.g., "Platform Server Notifications Service").
   3. Click **Create and continue**.
3. **Assign Roles to the Service Account**
   1. In the **Grant this service account access to the project** section, add the following roles:
      1. **Pub/Sub Admin**: Enables the account to manage Platform Server Notifications.
      2. **Monitoring Viewer**: Allows monitoring of the notification queue.
   2. **Tip**: If you can’t find these roles via search, manually browse for them under the **Pub/Sub** and **Monitoring** folders.
4. **Download the JSON Key**
   1. Once the roles are assigned, navigate to the **Service Accounts** page in the Google Cloud Console.
   2. In the **Actions** menu (three dots) for the new service account, select **Manage Keys**.
   3. Click **Add Key** > **Create new key**.
   4. Choose the **JSON** format and download the JSON key.
   5. **Important**: Keep this JSON key secure, as it will be required in **Step 4** of the setup process.

<figure><img src="https://380225236-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcoDfVWiJBvgTq8DbifIH%2Fuploads%2FjZhz0jz5JfePb9rOte4s%2F7706775-Crede_Step2aaaa_1294f8cec28bcec881ddd3946290d2b7-cec9dd14bc74a4e1c214161f01a332c6.gif?alt=media&#x26;token=b42b37ab-1587-4a0d-8a94-e47ee5973d7c" alt=""><figcaption></figcaption></figure>

<mark style="color:orange;">**Step 3. Grant Financial Access**</mark>

1. **Access Users and Permissions**
   1. In the Google Play Console, navigate to the **Developer homepage**.
   2. Go to **Users and Permissions**.
2. **Invite the Service Account**
   1. Click on **Invite user**.
   2. Enter the email address of the service account created in Step 2.
3. **Set Permissions**
   1. Under **App permissions**, select your app to grant permissions specific to it.
   2. Under **Account permissions**, enable the following permissions:
      1. **View app information and download bulk reports (read-only)**: Allows access to view app details and download bulk data reports.
      2. **View financial data, orders, and cancellation survey responses**: Grants access to financial data and customer feedback.
      3. **Manage orders and subscriptions**: Allows management of customer orders and subscriptions.

* **Note**: Other permissions can be set based on your needs, but the three permissions listed above are essential for financial access.

4. **Send the Invitation**
   1. Scroll to the bottom and click **Invite user** to activate the service account under **Users and Permissions**.

<figure><img src="https://380225236-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcoDfVWiJBvgTq8DbifIH%2Fuploads%2Far0DitFYkj654eFVc607%2F281139142-1bebe299-60db-4001-9329-0250324edb12.gif?alt=media&#x26;token=578c7332-d44a-4d0d-be32-f1c900b22cf5" alt=""><figcaption></figcaption></figure>

<mark style="color:orange;">**Step 4. Share Credentials JSON and Package Name**</mark>

**Package Name**

Provide the unique package name for your application (e.g., `com.example.app`).

**JSON Key**

To integrate with Google Cloud, you must share the JSON Key from **Step 2** with the Customer Success or Product Team securely.

**Push Notification Configuration**

During Google Cloud Console configuration, push notifications must be set up to work with Conscent.

* Set up push notifications with the URL provided by Conscent and the Play Console.
* Follow the detailed guide here for push notification configuration: [Simplifying Google Play Console Cloud Project Setup](https://valueoutput.com/blogs/simplifying-google-play-console-cloud-project-setup-for-inapp-purchases/8zmvEBB5bwLWa7AmORhl)

**Subscription Plans Configuration (Conscent Dashboard)**

Please provide the following details for each subscription plan you wish to configure:

| Required Details        | Description                                                                                          |
| ----------------------- | ---------------------------------------------------------------------------------------------------- |
| Subscription Product ID | Unique identifier for the subscription plan (e.g., <mark style="color:purple;">sub\_monthly</mark>). |
| Base Plan ID            | Base plan identifier (e.g., <mark style="color:purple;">base\_plan\_123</mark>).                     |

**User Purchase Information:**

To complete the user purchase tracking, provide the following details:

<table><thead><tr><th width="279">Required Details	</th><th>Description</th></tr></thead><tbody><tr><td>User Purchase Country</td><td>The country of the user making the purchase (e.g., IN, US).</td></tr><tr><td>Base Plan ID</td><td>Base plan identifier associated with the purchase (e.g., <mark style="color:purple;">base_plan_123</mark>).</td></tr><tr><td>Subscription Product ID</td><td>Unique product identifier for the purchased item (e.g., <mark style="color:purple;">prod_456</mark>).</td></tr><tr><td>Purchase Token</td><td>Purchase token generated after the user completes a purchase (e.g., <mark style="color:purple;">purchase_token_xyz123)</mark>.</td></tr></tbody></table>

**Example Purchase Details:**

```json
{
  "orderId": "GPA.3311-5236-4464-24316",
  "packageName": "com.csc_demo",
  "productId": "conscent_product_id_1_m",
  "purchaseTime": "1738058807395",
  "purchaseState": 0,
  "purchaseToken": "ajibimdaeaiadogkflhpeggn.AO-J1OzRSKQF3Xyr4BHuN3Mxqe7YQwCqZwjB1G_Mi5IiIEL6hH64bAC1ak7TO4SGbh3zu5dOJkiUAx2Gc_-83xcLpHQrV-s9mw",
  "quantity": 1,
  "autoRenewing": true,
  "acknowledged": false
}

```

**Note**: Add the Conscent webhook URL to the Google account.[​](https://www.revenuecat.com/docs/service-credentials/creating-play-service-credentials#2-create-a-service-account)
