Testing In app Billing Android

Posted By : Avilash Choudhary | 03-Dec-2015

Google Play Developer console provides many tools which help in test your In-app billing implementation

  • Static billing response for testing, from Google Play in soon development

  • Test purchases which let license test users purchase published in application items without real charges to their accounts

Testing In app Purchases

Test purchase in-app SKUs in two ways

  • Real purchases that let just users make original buying of your in-app products with real charges to user’s payment instruments.

  • Test purchase that let selected license-test users buy in-app products without resulting charges to user. It could be used in beta/alpha releases only.


Test Purchases (In app Billing Sandbox)

It offer convenient and secure way to enable larger scale testing of in-app billing implementation during preparation or development for launch. Also let authorised user account make purchasing in-app products without any real charges to user accounts through Google Play.

When purchasing is complete, Google Play prevent order from going to financial processing, confirm that there are no real charges to user accounts and automatically cancelling complete orders after 14 days.

Setting up Test purchases

Any user account can be select to be test account and any user of test account can make test purchases with any available payment method.

First upload and publish in-app products that you want testers to able for purchase. You can upload and publish in-app products in Developer Console.

After then create license test account for authorized users. Go to Settings > Account details then in developer console then in license testing section add address to Gmail account with testing access field. Now within 15-20 minutes those user can begin make test purchasing of  in-app products.


Test purchases and developer account

Authorized license test account are allied with developer account, rather than with special APK or package name. Identify account as test account not disable it to purchase any in-app products without being charged.

Details of purchase flow

During this test purchase, users test actual purchase, fulfillment, and merchandising flow in application. Inapp item is shown as normal item with actual price. Google play marks purchases with notice across centre of purchase dialog, for simple identify.

Cancelling completed test purchases

Google Play collect completed test purchases for each user but doesn’t pass them on to financial processing. Overtime, automatically clears out purchases by cancelling them. Note revoke and refund methods don’t support test purchases

For cancelling purchasing, you have these options

  • Cancel purchase manually - Go to Google payments merchant center, look up transaction and cancel it. You can also find transactions by look up their order numbers.

  • Wait for transaction to expire - After their purchase date Google Play clears completed test purchases 14 days.


Testing with real transaction

You can make use of Google play beta/alpha release options to do load testing and validation on implementation before distributing application to users  as you prepare to launch application that uses In-app billing.

Real users can install application from Google Play and test in-app products with beta/alpha test groups. It make real purchases that result in real charges to their accounts using any payment methods in Google Play to make Purchase.

Testing with static response

It enables to verify app is handling primary Google Play responds properly and app is able to verify signature correctly.

You make in-app billing request using special item that have reserved product ID to test implementation with static responses. No money is transfer when you make in-app billing requests with reserved product IDs. Each reserved product ID returns specific static response from Google Play. Checkout flow for reserved item that has product ID android.test.purchased.



You don’t need to list reserved products in apps product list because Google play already know about product reserved IDs. Also you don’t need to upload app to developer console to perform static response test with product reserved IDs.

Four reserved product IDs for test static in-app billing responses are mentioned below:

  • android.test.purchased : When you make In-app Billing request with this product ID, Google Play responses as though you proudly purchasing item. This response include JSON string, which contains fake purchasing data.

  • android.test.cancelled : When you make In-app Billing request with this product ID, Google Play responds as though purchase was canceled. This can occur when error is found in order process, such as invalid credit card or when you cancel user’s order before it is charged.

  • android.test.refunded : When you make In-app Billing request with this product ID, Google Play responses as though purchase was refunded. Refund can’t be initiated through Google Play’s in app billing service. Refund message sent to your app by Google Play, after you process refund request through Google Play merchant account. It occurs when Google play get notified from Google Payments that refund has been made.

  • android.test.item_unavailable : When you make In-app Billing request with this product ID, Google Play responses as though item being purchased was not listed in apps product list.

Following are the steps to test app using reserved product IDs

  • Install app on android powered device

  • Sign in to device with developer account

  • Verify that device is running supported version of Google Play app

  • Run app and purchased product IDs

Setting up for Test Purchases

Testing real in-app purchases enable to test end to end in-app billing experience, including actual purchases from Google play and actual checkout flow that user will experience in app.

Test account purchase item in your product list only if item is published.

Following are steps to test in-app billing implementation with actual purchases

  • Upload app to alpha distribution channel with developer console

  • Add items to apps product list

  • Install app on android powered device

  • Verify that device is running supported version of Google Play app

  • Make in-app purchases in app

When you finished testing In-app Billing implementation, you are ready to publish app on Google play.


About Author

Author Image
Avilash Choudhary

Avilash has excellent experience in developing mobile and web applications using jQuery , Javascript and PhoneGap. His hobbies are watching and playing cricket.

Request for Proposal

Name is required

Comment is required

Sending message..