Testing Android Market in-app billing with dummy credit card credentials

Kaiesh picture Kaiesh · Jul 20, 2011 · Viewed 21.5k times · Source

I have configured an Android application to use the in-app billing module as documented at: http://developer.android.com/guide/market/billing/index.html

It works fine when tested using the UK development team's accounts which have real credit cards associated with them. However, part of my development team is based in China, and as Google Billing does not operate in China, they are unable to test the billing functionality.

Understandably the team is uncomfortable sharing personal card details, or personal account information with others. Does anybody know a work around for this? While in testing, can dummy card numbers be associated with the account?

I know this works in the merchant sandbox (http://code.google.com/apis/checkout/developer/Google_Checkout_Basic_HTML_Sandbox.html) but I can't seem to find an equivalent for Android billing testing.

Any help/guidance/support would be appreciated here. The China team is focused on a lot of the modules related to the post-purchase experience and this will be seriously compromised if we cannot find a workaround.

Thanks!

Answer

amalBit picture amalBit · Oct 15, 2013

Update:
Inappbilling library 1.0 just released to make this easier.


Kumar Bibek has already answerd above: Still I am giving an explanation:

Hardcode the following debug options in the launch purchase flow to get the desired output.

  • android.test.purchased
  • android.test.canceled
  • android.test.refunded
  • android.test.item_unavailable*

    mHelper.launchPurchaseFlow(Activity.this, "android.test.purchased", 1000, mPurchaseFinishedListener, payload);

The above will give these screens:

enter image description here

On clicking Buy.

enter image description here