> For the complete documentation index, see [llms.txt](https://docs.appmysite.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appmysite.com/app/monetization/configure-in-app-purchase-android.md).

# Configure in-app purchase (Android)

#### How to connect in-app purchases with Google Play Console

If your app unlocks digital content such as premium features, subscriptions, Google recommends using In-app purchases.

Before starting, ensure you have already created the in-app purchase product in your AppMySite dashboard. You will need the generated Product ID during this setup.&#x20;

{% embed url="<https://scribehow.com/viewer/Configure_in-app_purchase_Android__et59XN3BTjOzpom-aaZ9cA>" %}

#### Step 1: Set up a Payments profile

* Log in to [Google Play Console](https://play.google.com/console/u/0/developers/signin).
* From the left side menu, go to Settings.
* Click Create payments profile.
* Complete the required payment details.

{% hint style="warning" %}
In-app purchases cannot be enabled without an active Payments profile in Google Play Console.
{% endhint %}

#### Step 2: Enable real-time developer notifications

* In Google Play Console, select your app.
* From the left menu, go to Monetisation with Play > Monetisation setup.
* Under Google Play Billing, enable Real-time developer notifications.
* Add a topic name. The topic name is the Project ID that you can find in your Firebase account
* To find your Project ID: go to Firebase > Settings > General.
* Copy the Project ID.

{% hint style="info" %}
Enter the topic in this format: projects/PROJECT-ID/topics/play-notifications
{% endhint %}

* Under Notification content, select Subscriptions, voided purchases, and all one-time products.
* Click Save changes.

{% hint style="warning" %}
The Project ID is unique for all accounts and must match the Firebase project connected to your Android app.
{% endhint %}

#### Step 4: Configure Pub/Sub in Google Cloud Console

* Log in to [Google Cloud Console](https://console.cloud.google.com/getting-started).
* Select the project linked to your Android app.
* Search for Pub/Sub and open it.
* Click Create topic and enter a topic name.
* Open the created topic and click the subscription ID.
* Click Edit.
* Set Delivery type to Push.
* Copy the Endpoint URL from your AppMySite In-app purchase dashboard and paste it into the Endpoint URL field. You can find the Endpoint URL in the Server URL field in your AppMySite In-app purchase dashboard
* In Subscription permissions, click Add principal.
* Add: <google-play-developer-notifications@system.gserviceaccount.com>
* Assign the role Pub/Sub Publisher.
* Click Update to save changes.

{% hint style="warning" %}
Ensure the Endpoint URL is copied exactly from your AppMySite dashboard to allow proper validation of in-app purchases.
{% endhint %}

#### Step 5: Configure in-app products

* In your Google Play Console, select your app from the app listing screen.
* From the left navigation menu, go to Monetize > Products >One-time products/Subscriptions.
* Click Create one-time product/Create Subscriptions.
* Enter the Product ID generated in your AppMySite in-app purchase dashboard.
* Fill in the remaining product details.
* Click Save.

{% hint style="danger" %}
The Product ID in Google Play Console must exactly match the Product ID created in your AppMySite dashboard.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.appmysite.com/app/monetization/configure-in-app-purchase-android.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
