Setup In Developer Console

Make sure that androidnative.jar and AndroidManifest.xml is inside your Assets/Plugins/Android folder.

To implement in-Apps in your application, you should create new android application in google developer console and pass some info to the plugin. See instructions below how to set up and run billing example scene.

1) Create new Application in Google Developer Console and get public license key. See the step below:

  1. Go to the Google Play Developer Console site and log in. You will need to register for a new developer account if you have not registered previously. To sell in-app items, you also need to have a Google Wallet merchant account.

  2. Click on Try the new design to access the preview version of the Developer Console, if you are not already logged on to that version.

  3. In the All Applications tab, add a new application entry.

    1. Click Add the new application.

    2. Enter a name for your new In-app Billing application.

    3. Click Prepare Store Listing.

  4. In the Services & APIs tab, find and make a note of the public license key that Google Play generated for your application. This is a Base64 string that you will need to include in your application code.

Your application should now appear in the list of applications in Developer Console.

2) Pass public license key to the plugin.

Open Window -> Android Native -> Edit Settings

And specify your Base64 key under the Billing tab:


Setting Up for Test Purchases

To test your In-app Billing implementation with actual in-app purchases, you will need to register at least one test account on the Google Play Developer Console. You cannot use your developer account to test the complete in-app purchase process because Google Wallet does not let you buy items from you. If you have not set up test accounts before, see Setting up test accounts.

Also, a test account can purchase an item in your product list only if the item is published. The application does not need to be published, but the item does need to be published.

To test your In-app Billing implementation with actual purchases, follow these steps:

  1. Upload your application as a draft application to the Developer Console.

  2. Previously, you could publish a "draft" version of your app for testing. This functionality is no longer supported. Instead, there are two ways you can test how a pre-release app functions on the Google Play store:

    1. You can publish an app to the alpha or beta distribution channels. This makes the app available on the Google Play store, but only to the testers you put on a "whitelist".

    2. In a few cases, you can test Google Play functionality with an unpublished app. For example, you can test an unpublished app's in-app billing support by using static responses, special reserved product IDs that always return a specific result (like "purchased" or "refunded").

  3. Add items to the application's product list.

  4. Make sure that you publish the items (the application can remain unpublished). See Creating a product list to learn how to do this.

  5. Install your application on an Android-powered device.

  6. You cannot use the emulator to test In-app Billing; you must install your application on a device to test In-app Billing.

  7. Verify that your device is running a supported version of the Google Play application or the MyApps application.

  8. If your device is running Android 3.0, In-app Billing requires version 5.0.12 (or higher) of the MyApps application. If your device is running any other version of Android, In-app Billing requires version 2.3.4 (or higher) of the Google Play application. To learn how to check the version of the Google Play application, see Updating Google Play.

  9. Make in-app purchases in your application.

Note: The only way to change the primary account on a device is to do a factory reset, making sure you log on with your primary account first.

When you have finished testing your In-app Billing implementation, you are ready to publish your application on Google Play. You can follow the normal steps for preparing, signing and publishing on Google Play.


Signing and Uploading apk with Unity

To be able to create in-app purchases you should upload your apk file to the developer console. Apk must be signed with your private key. By default when you build apk file with Unity, it signed with the debug key. It means that it not suitable for upload to the google developer console.

There are a lot of ways you can create the private key for your application, you can read more here about android application signing, or use Unity build-in tools:

Next step is app configuration.

You have to choose your bundle ID

A bundle ID otherwise known as a package in Android is the unique identifier for all Android apps. It needs to be unique as when you upload it to Google Play it identifies and publishes your app use the package name as the unique app identification.

Really it is the only thing which is necessary to identify your app, and generally it has 3 parts:


Where example is generally the company/publishers name, and the Test App is the app name.

You will not be able to upload an APK to the store which has the same package as another app already in the store.

When you bundle ID is ready add it to the Unity application setting and to the  AndroidManifest.xml.

Also Plugin use version 3 of Android In-app billing. This is lasted Android billing API and it requires minimum Android 2.2.x(FROYO) SDK int 8 or higher.

Here is screenshot of required setting in Unity.


You can build your signed apk file now. Just press build button.

Note: You should have latest android SDK on your computer, to make Unity able build apk file.

Note: Android plugin should be included to your application, if you will build signed application without plugin included, application will not have permissions to use billing.


After signed apk is created you can upload it to the Google. Choose your created application on Google Developer Console, open APK tab and press “Upload your First APK to Production” button.

After apk is uploaded you can start testing the example scene and try to modify PaymnetManagerExample class to work with your products, or create your own using   PaymnetManagerExample as an example.



Testing for In-App Billing, Licensing, and APK Expansion Files Previously, you could use your Draft APKs to test these features. After a recent change, testing your features using Draft APKs is no longer supported. You must now publish your app to the alpha or beta distribution channels to test your implementation of these features. For more information, please refer to the documentation available on the Android Developers site.