Question

I want to test the in app subscription mechanism on android devices(In app billing V3. api). How can I do this? I saw that testing with static responses is works only with the in app products. The beta/alpha testing supports the in app subscriptions?

Thank you.

Was it helpful?

Solution

You can test your app with in app purchase feature. you have to follow below steps for testing

  1. Upload you final signed apk file to Google play.
  2. Dont publish it
  3. Add in app products
  4. get in app products id and add to code
  5. get base 64 key and add to product
  6. sign apk and upload again
  7. your app should be in draft mode
  8. in you Google play account setting add your test account id
  9. use the device which should have the primary account id similar to the one you have added on Google play test account.
  10. Install signed apk you have uploaded to Google play to your device.
  11. run application and test your features

OTHER TIPS

Since there's no effective way to test subscription cancellation/renewal, I'm trusting Google's documentation that an expired subscription won't appear in purchased items (otherwise, whether cancelled but still valid, original or renewed, I don't care in my case).

To test the rest of my work flow I created a test consumable object so that I can re-buy/cancel it at will in the sandbox. This consumable simulates an active subscription. It's not full end-to-end testing, but given that Google's given us no better way to test subscriptions, it will at least give me a fair amount of confidence that my app behaves as expected, otherwise.

A few notes:

1) You can only test with a signed build. I added android:debuggable="true" to my AndroidManifest.xml (under <application android:debuggable="true"...)

2) This way I can still connect and debug with breakpoints after installing via adb (you can attach to the process under the Devices view, normally visible in the DDMS perspective, look for the little green bug icon.)

So far, it's behaving as expected. I'm still in the process of testing but if I hit any snags I'll update.

In adittion to @Vaibhav-Agarwal if you only want test your app, you could have problems with the IDs (I have experienced with an app for a client).

In my case, to avoid this situation, I had to add a testing project with another special package (test.xxxx.xxxx.xxxx) and here add some in-app product with a trial of 7 days, then when I canceled a purchase I "only" had to wait 7 days to purchase again this subscription.

In this way also,you never had to make a refund, because the subscription with trial time, you haven't to pay until this trial time finish.

NOTE:

Draft Apps are No Longer Supported, you must use Alpha/Beta tester option

In spanish, you will read: "no se ha podido encontrar el elemento que intentabas comprar"

Google has been enhanced theirs In-app Billing testing options. I write this answer for those who coming through . Now, you can test In-app Billing in Sandbox as other platforms do. In order to do that you have to create license test accounts for authorized users.

In the Developer Console, go to Settings > Account details, then in the License Testing section, add the addresses to Gmail accounts with testing access field.

Notes :

  • Test subscription purchases recur daily, regardless of the product's subscription period.
  • Once you’ve added the users as license tester accounts and saved the change, within 15 minutes those users can begin making test purchases of your in-app products.
  • After you publish your app to an alpha or beta channel, your testers need to opt-in to your app’s alpha or beta test using the provided opt-in URL before they can make test purchases.
  • License test accounts must be on the user’s Android device. If the device has more than one account, the purchase will be made with the account that downloaded the app. If none of the accounts has downloaded the app, the purchase is made with the first account. Users can confirm the account that is making a purchase by expanding the purchase dialog.

For more visit the official documentation.

But you can test Google Play functionality with an unpublished app using static responses.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top