How to add Google in-app purchase?

This guide will show you how to add Google in-app purchases to you project.

Let's create an IDs for Google purchases.
I'm doing something like this:

*com.yousite - you package name
com.yousite.iap1 - for buy 30 credits
com.yousite.iap2 - for buy 70 credits
com.yousite.iap3 - for buy 120 credits

save constants - in BalanceActivity.java file (ITEM_SKU_1 = "com.yousite.iap1"; ITEM_SKU_2 = "com.yousite.iap2"; ITEM_SKU_3 = "com.yousite.iap3")

Remember!
a) 5,6,7,8,9,10 steps you need to perform 3 times! For (step 6) com.yousite.iap1, com.yousite.iap2, com.yousite.iap3!
b) Purchases does not work if the application does not published in Google Play and is not installed on your device from Google Play!
c) You can not make purchases in your own app! Use a different Google Account for testing!
d) To test purchases (without using real money), you can activate "GOOGLE_PAY_TEST_BUTTON = true" in Constants.java

How to add Google in-app purchase

Select "Services & APIs" and copy IN-APP BILLING (Selected on screenshot) to Constants.java (BILLING_KEY)

How to add Google in-app purchase

Go to https://play.google.com/apps/publish
Create a application and upload your apk

4.) Select you application

How to add Google in-app purchase

Select "In-app Products"

How to add Google in-app purchase

Select " Add new product"

How to add Google in-app purchase

Enter data and click "Continue"

How to add Google in-app purchase

Click "Add price"

How to add Google in-app purchase

Enter data and click "Apply"

How to add Google in-app purchase

Enter data and click "Activate"

How to add Google in-app purchase