# IAP on Android devices

## Enabling in-app purchases

Start a build after enabling in-app purchases by clicking the button in this section.

Once the build is complete (this can take up to 30 minutes), go to *Google Play Console → App → Test and release → Testing → Internal testing*. Save the draft release that was automatically created when the build file was sent to the Play Console.

If you received a build success email but don’t see a draft release with the new build file, manually create a draft release and attach the build file provided in the email.

Click the button to verify that everything is properly connected.

### Handling billing notification events

Because in-app purchases are completed through Google’s interface, your app needs a way to detect when a user performs actions such as subscribing to or canceling a plan. Google Play Billing sends server-side notifications whenever these events occur. This step ensures your app’s backend is properly connected to Google Play Billing.

Click the link to open your Google Cloud permissions and add the following permission levels:

* *Pub/Sub-Admin*
* *Service Account User*

The *Manage permissions* option is located in the three-dot actions menu.

<figure><img src="https://34394582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M5sbzwG7CljeZdkntrL%2Fuploads%2F3MrBcQ2uI6nTL0ZPDcdU%2Fimage.png?alt=media&#x26;token=08517853-02ff-49e2-b87f-318a9c683007" alt=""><figcaption></figcaption></figure>

After adding the permissions, wait about 10 seconds. Then return to Bubble and click the button to automatically create a Pub/Sub configuration.

If this doesn’t work, make sure billing is enabled for your Google Cloud project and that the Pub/Sub API is enabled (step 3 in Google’s Pub/Sub documentation).

### Testing setup

{% stepper %}
{% step %}

### Copy the new pub/sub name

Then go to Google Play Console > Monetize with Play > Monetization setup > Enable notifications.
{% endstep %}

{% step %}

### Check the box

Check the box to *Enable real-time notifications* and paste in the *Topic Name.*

<figure><img src="https://34394582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M5sbzwG7CljeZdkntrL%2Fuploads%2FXmoKkL5OpoaemXP98ACW%2Fimage.png?alt=media&#x26;token=d3684e91-053c-429e-81a7-cd225484a242" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Send a test notification

Still in the Google Play Console: *Click Send a test notification.*
{% endstep %}

{% step %}

### Confirm

Return to Bubble and ensure a test notification has been successfully received.
{% endstep %}
{% endstepper %}

If you encounter an error, check *Google Play Console → Products → Pub/Sub* to find the Google in-app purchase subscription that was created.


---

# Agent Instructions: 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:

```
GET https://manual.bubble.io/help-guides/getting-started/building-for.../native-ios-and-android/in-app-purchases/iap-on-android-devices.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
