Google Play In-app Billing

How to test sample app.

1. Download sample app using “Android SDK Manager” in eclipse

. Start “Android SDK Manager” in eclipse
. Go to “Extras” folder
. Check “Google Play Billing Library” and install it
. The files are downloaded to %android_home%\extras\google\play_billing folder

2. Read In-app Billing overview documentation
https://developer.android.com/google/play/billing/billing_overview.html

. learn what is In-app Billing
. learn what type of products are available

3. Create a project in eclipse with the sample app

. Go to eclipse and import the sample project in
%android_home%\extras\google\play_billing\samples\TrivialDrive
. Rename the project and package name
. Go to Android tools in eclipse and do “Export signed application package”

4. Setup In-app Billing environment in Google developer console

. Go to Google Play Developer Console
http://play.google.com/apps/publish
. Create a app for the new sample project (mak sure you use the same package name)
. Setup products in “In-app Products”
. Get license key in “Services & APIs”. You have to enter this info in your program
. Documentation
https://developer.android.com/google/play/billing/billing_admin.html

5. Modify the android program

. Come back to eclipse
. Add the license key.
. Export the signed application again.
. Upload to Google Play Store

6. Test

. Install the latest apk in test device or emulator using adb
. Test

* Be careful

1. versionCode in AndroidManifest.xml
The number in your local app should be lower or equal of the one of currently published

2. Signed / Unsigned
Don’t use the unsigned version. It uses debug.keystore which published version never uses.

3. Test account
Remove your published gmail in test devices. Use the registered test gmail account in your test device or emulator.

* Possible errors

1. This version of the application is not configured for billing through Google Play. Check the help center for more information

http://stackoverflow.com/questions/11068686/this-version-of-the-application-is-not-configured-for-billing-through-google-pla

This error is normally cause by the mismatch of the information of application.
Check you run “signed” test app. Unsigned app (which has debug certificate) won’t be recognized as correct application.

Check the version code. the one in AndroidManifest shoule be the same as the currently uploaded apk’s versionCode

2. The publisher cannot purchase this item

Make sure you have test account set in Google Play store of your test device. If you have the developer’s account in your test device or emulator, you won’t be able to purchase.