Search code examples
androidin-app-purchasein-app-billingandroid-billing

Cannot Testing with Static Responses


I'm trying to implement an InAppBilling in my Android app.

I'm almost there, but there is still one part missing.

I've followed the documentation (http://developer.android.com/google/play/billing/billing_integrate.html#Subs) and replicate the logic used in the sample app provided by Google.

I have this application published in alpha mode, with one test account and an integrated product (subscription) created.

String payload = "";
mHelper.launchPurchaseFlow(Settings.this, SKU_PREMIUM, IabHelper.ITEM_TYPE_SUBS,null, 1000, mPurchaseFinishedListener, payload);

If SKU_PREMIUM variable is the real product id defined in google console, everything is fine. I windows appears in my application telling me to buy the subscription, and its price. However, given that I do not have a visa card associated to my test account, I cannot proceed. Thus, I'm trying to use Static Responses. However, if I change SKU_PREMIUM to "android.test.purchased", I'm given an error saying The item you requested is not available for purchase.. And even if I change reserved code to android.test.canceled, android.test.refuned or android.test.item_unavailable the outcome is the same.

What am I missing here? Thanks!


Solution

  • The problem is that you cannot use reserved product ids on subscription testing. They are only suitable for "normal" purchases. For subscriptions you to use the right subscription id defined by you in google play settings page. You should:

    1. Upload an apk to store (it can be in alfa or beta testing);
    2. Be the application tester (the email should be different from the developer email);
    3. Have a credit card associated to your test account.

    If you have this setup, you won't be charged by Google. Note that in-app subscriptions auto-renew every 24h.

    As far as I know, there is no easy way to test the android in-app billing. You really have to follow theses steps.