19

Background

My app has some in-app billing (like this one), and I wish to test it out before publishing it.

I've watched some google IO lectures and read some articles, and prepared everything.

According to what i've learnt (talked about here), all I need to do is just add my email to the test accounts, and it won't be charged.

The problem

It seems that in the developer console, the in app items cannot be activated.

I think it's because the app isn't published yet, but that's the whole point of testing - I want to test the app before publishing it...

As I've also found out, in order to test in-app billing, I have to do a lot of things to take care of for making it work, also having many restrictions and annoyances:

  1. sign the app and upload it to the play store . if you don't use a signed app, you get this message ("This version of the application is not configured for Market Billing...") .

  2. make credit cards be used to the devices, even if they won't cost anything.

  3. let others do the testing instead of myself, as my account cannot be used for that. not only that, but instead of adding exactly which you wish to add, you have to create a google group and there put the people who will be able to use the app, and all will have to have a google+ account... You will also need to wait some time till the testers will be able to use in-app-billing of your app and till then they will get an error "User is not eligible for this purchase" .

  4. because of #1, I need to have some kind of mechanism to reset the purchases, within the app itself, but i also shouldn't forget to remove/hide this features for the end users, so that they won't reset it by mistake

  5. because of #1, if I wish to be able to debug the app, I need to change it on the manifest, and choose to debug the app within Eclipse, and also remember to uncheck this flag before actually releasing the app.

  6. since the app is on the play store, you cannot modify in-app purchases items (their Id for example), as opposed to many thing you can modify before publishing the app. It's no longer a development as flexible as it can be using simple development. It's like your app should be sealed with what you choose even though you haven't published it yet.

The question

Why is it this way?

How come there isn't a simple way to allow to test the in-app-billing ?

How would you deal with the problems I've written about?

Is it possible to test the in-app purchases before the app is published?

How come I can't use my own google account ?

Also, suppose I do make a (fake) purchase, how do I reset it (all/specific purchases) in order to check it out again? Is it true I can't do it anywhere besides the app itself?

Am I missing anything?

Community
  • 1
  • 1
android developer
  • 114,585
  • 152
  • 739
  • 1,270
  • 1
    sucks in Android. so easy to test in app purchase in iOS. – coolcool1994 Aug 16 '20 at 05:29
  • @coolcool1994 Actually it got easier. Now if you use your own account, it functions like a real purchase (but won't charge you, of course) – android developer Aug 17 '20 at 05:59
  • Because Google has no idea what tf they're doing, and they keep expanding everything into new "services" that are unrelated, for which you need new accounts and then link them together with secret keys. All the documentation is outdated so good luck. – Fabrice Bacquart May 25 '22 at 12:53

4 Answers4

2

you dont have to publish the app inorder to test it all you have to do is upload the apk to your developer console, just dont publish it. If your account is linked to your developer console you cannot use that account and have to create a test account to test the IAP's

tyczj
  • 71,600
  • 54
  • 194
  • 296
  • Why can't i use the same account? google just won't allow it? Also, since i have a work account, can i use it instead? How would I make the app use the account i want it to anyway? All i have is an APK file... – android developer Jan 06 '14 at 21:54
  • I dont know the specific reason that your cannot test with your developer account but if you try you will get an error saying that you cannot purchase the item using that account. You can only test with an account that is linked to the google play store so if your work account is linked then yes just create another user on the device and switch to that user when testing – tyczj Jan 07 '14 at 01:32
  • oh, but i don't have this feature as it's only available for tablets. maybe there is a tool for rooted devices to switch users? – android developer Jan 07 '14 at 06:22
0

You will have to public the app but publish in beta mode so that you can test the in app purchases. Beta mode will enable to test the functionality with limited user set.

Amrut
  • 543
  • 4
  • 8
0

Yes, you can test your app without publish (and without publish in beta mode too). There are instruction http://developer.android.com/google/play/billing/billing_testing.html#billing-testing-test. Please remember that after 1 point it's maybe need to wait about hour or two.

It seems that in the developer console, the in app items cannot be activated.

it's ok, just check that you mark it as active. It look like not active before you publish the app, but you can test it.

I can use my own google account, right?

I strongly recommended have additional account only for test purchases.

Also, suppose I do make a (fake) purchase, how do I reset it (all/specific purchases) in order to check it out again?

You'll must to fill billing information for your test account. But when you make test purchase, there are no any real money transaction. Every in-app can be tested once again after the app consume it.

  • But how can i choose which account to use? all i have is an APK file... Also, what's the "1 point" you are talking about? I also don't understand the resetting of the purchases - can this be done on the developer console, or should I add a hidden feature to consume all purchases within the app itself? – android developer Jan 06 '14 at 21:57
  • Sorry for delay. You must go in developer console at Settings and add test account (http://developer.android.com/google/play/billing/billing_admin.html#billing-testing-setup). Then log in your phone at the test account. Then install the APK file in your phone. That's all, you can test purchases. You say: " Also, what's the "1 point" you are talking about? " Sorry for misunderstanding. I mean, sometimes you need to wait few hours after uploading your APK file in developer console. – Helen Allien Poe Jan 09 '14 at 18:07
  • You say: "I also don't understand the resetting of the purchases - can this be done on the developer console, or should I add a hidden feature to consume all purchases within the app itself?". Yes, you need. Look at http://developer.android.com/google/play/billing/api.html#consume – Helen Allien Poe Jan 09 '14 at 18:10
  • 1
    Isn't there a better way to reset the purchases? Why are there so many restrictions on in-app-billing? it's so annoying: you need to sign the app, put it on the play store, set test accounts of other people (except for yourself for some reason), add credit cards (even though they won't be charged), add resetting of purchases within the app (and remember to hide/remove it for the end users), ... why couldn't it all be like testing the app within eclipse, like normal features are being tested (and fixed)? they made it look so easy on the lectures, but it's a very annoying thing. – android developer Jan 11 '14 at 11:33
  • Actually, you can use fake purchases http://developer.android.com/google/play/billing/billing_testing.html#billing-testing-static. You cannot test all cases, but most of them should work. Hope it help you. – Helen Allien Poe Jan 12 '14 at 19:18
  • 1
    no, it won't work. it will just tell you it succeeded/failed/anything you tell it to . it won't have anything related to the real flow of purchases. it almost isn't worth anything :( – android developer Jan 12 '14 at 22:31
0

I'm also working on how to test In-App-Billing for Android in best way since days.

With real transactions to me it seems to be really too complicated and a lot too much effort. So i'm currently thinking of 'only' testing this stuff with static responses (http://developer.android.com/google/play/billing/billing_testing.html#billing-testing-static).

In theory i guess once this works, it should also be fine in production as in the source code only the SKU id gets changed for live release..

nr1
  • 777
  • 3
  • 12
  • 31