Integrate IAP for Google Play with SDKBOX


Getting IAP working for google play basically involve the following major steps –

  • Setup store listing in Google Play Console.
  • Integrate purchase logic with your code.
  • Adding In-app items for your app.
  • Adding your app into Alpha/Beta testing phase.
  • Testing IAP.

Setup your IAP in Google Play

Before integrating IAP into your game, you have to setup your Android application with Google Play Console with the following steps –

1. Signup

Make sure you have a Google Play Developer account, you can sign up here.

2. Create new application

Create a new application in Google Play Console by clicking on the +Add new application button.


3. Name your application

Name your application and click “Prepare Store Listing”.

We select “Prepare Store Listing” instead of “Upload APK” here, because there is still code change needs to be done.


4. Filling the blanks

Complete all the required fields in “Store Listing” section, If you don’t complete this section, you won’t be able to create IAP products later.

5. License key

Obtain your IN-APP-BILLING license key from “Services & APIs” tab


6. Edit sdkbox_config.json

Edit your sdkbox_config.json file and replace the “key” element with your in-app-billing key from previous step

7. Add your IAP items

Add your IAP items to sdkbox_config.json

For example if you have the following item in your game

  • “remove_ad” will remove the ad for player.
  • “coin_package” will give player 5000 in game currency.


Your sdkbox_config.json will look like this –


8.  Release build

Create a release build of your application and sign with your release keystore


9. Upload APK to alpha testing

It’s really important to make sure you published to alpha testing



10. Setup IAP products

Now you should be able to add new IAP products


Be sure to select “Managed product”

And the product ID should match the the one in sdkbox_config.json


Once created, make sure to it’s active before you can test it



After this step you can get a coffee and take a break, because your IAP for Google Play is all set.


Integrate IAP with your code

Initialize iap when your app starts with following function –

Make purchase with following code

Note: the “remove_ads” is what’s in the sdkbox_config.json we edited earlier


Testing IAP

There are two ways to test IAP

1. Testing as a tester

You can add people as alpha testers so they will be able to download the application from Google Play and test it


However, this method has it’s limitations, for example it’s impossible to debug the IAP process, if there is a bug.

2. Testing as a developer

If you want to test IAP in your development environment, you have to make sure two things –

2.1 The version in your AndroidManifest.xml has to match with the one you uploaded to Google Play



Google Play


2.2 You have to run the Application as a release build

And make sure it’s signed with the same release key as the version you uploaded to Google Play.

After that you should be able to test Google Play IAP locally using the same test ID’s added to the google play.

Suggested Reading :

You may also like to read –

Posted in programming Tagged with: , ,