# Integrating Unity IAP with Google Play

Notes from a 2023 Unity in-app purchase integration: permissions, Player settings, license keys, and store testing.

These are my notes from integrating Google Play in-app purchases with Unity in April 2023.

## Upload a build with billing permission

Add this permission to `AndroidManifest.xml`:

```xml
<uses-permission android:name="com.android.vending.BILLING" />
```

After uploading the APK and getting it approved, create the in-app products or subscriptions in Google Play Console.

## Install Unity IAP

Open **Window → Package Manager → Unity Registry**, select **In App Purchasing**, and install it.

## Check Unity Player settings

Go to **Edit → Project Settings → Player**:

- Under **Other Settings**, use **IL2CPP** as the scripting backend for this setup.
- In the configuration section, set **API Compatibility Level** to **.NET Standard 2.0** or later.
- Make sure the package name matches the registered app.
- Enable **Build App Bundle (Google Play)**.

## Add the Google license key

Find the key on the monetization settings page in Google Play Console. Enter it in the project's **In-app purchase (IAP) settings** on the Unity Dashboard.

In my setup, the corresponding Unity editor panel could report an error. I configured the key through the Dashboard instead.

## Add license-test accounts

In Google Play Console, open **License testing → License testers** from the home page.

License testers and internal-testing participants are different lists. Configure the relevant accounts in each. In the original test setup, China-region accounts could not complete payments; account region was one of the things I needed to check.

## Test the store build

Publish an internal-testing build and download it from Google Play. Testing that installed store build was necessary for this workflow.