Im trying to get In-App Billing to work. I have followed the tutorial from http://blog.blundell-apps.com/simple-inapp-billing-payment-v3/ somewhat, and I get purchases working. Although from both my testing devices at some point it stops to work. What also stops to work at the same time is paid apps in full and Ill only see free apps.
From my developer account testing against the reserved products, i found out the reason that my account had somehow been logged out? And when logging back in it work, happy with that :)
From my testing account against the published product I got a message saying "product not availabe from merchant" or something like that. Then that account is crashed (not available to make purchases) and I cannot get market working again.
I have:
- Verified multiple accounts does not exist
- Ensured my account is still logged on to market (the case from developer account)
- Cleared google play cache
- Removed the account as testing account
- Restarted the device
Any ideas here? I could understand if my app wouldn't work due to poor coding, but what is this behaviour, diasabling the market for the account? Could google play block my account due to spam? And does 10 IAB setups or so count as spam?
Thanks in advance!
Developers cannot purchase their own products. So you can build a signed version of your apk and test it on a device who's primary account is not tied to your developer account. I had to use my wife's phone to test my IAP. Also note that you have to wait a while before your products (SKU's) will be available.
Related
I'm trying to implement in-app billing using Android, but I'm getting a weird error and I can't find anyone online with a similar problem.
I've done the following:
Uploaded APK with billing permission to developer console as alpha
build.
Added Google group to test, with my personal gmail account as
a member.
Gone to the opt in URL and become a tester.
Added my personal gmail account as an account enabled for testing (in settings > account details).
Created a non-consumable product and set it to "active".
Waited 24 hours.
Put a signed release build on my phone.
When I press the "Buy" button, it opens the store dialog, which says "This is a test order, you will not be charged". All seems good so far, but every payment method says "This payment method has been declined." so I'm unable to continue. This includes Google Play balance, Amex card, Visa and PayPal account.
I've tried the following, none of them worked:
Used a different google account for test payments.
Removed my account from the list of test accounts in the developer console settings to try and use with "real" transactions.
Tried a different device.
Tried creating a different product.
Any thoughts on what might be wrong?
Google support have advised that the error is caused because the merchant account is "under review". They're looking into the reasons for the review and attempting to resolve the issue. I'll update this answer with their final response.
The best advice is to contact Google support through the merchant help centre: https://support.google.com/merchants
Update: Google fixed the account and it started working straight away. You definitely need to contact them to get this sorted.
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.
You can test your app with in app purchase feature. you have to follow below steps for testing
Upload you final signed apk file to Google play.
Dont publish it
Add in app products
get in app products id and add to code
get base 64 key and add to product
sign apk and upload again
your app should be in draft mode
in you Google play account setting add your test account id
use the device which should have the primary account id similar to the one you have added on Google play test account.
Install signed apk you have uploaded to Google play to your device.
run application and test your features
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.
I am very confused about this, both from the developer site and other similar questions.
I am trying to use V3 in-app billing. Seems to work with the static responses. Want to move on to testing with test purchases using license test accounts.
Basically - it is not working.
A signed app has been uploaded to the developer site (over 6 hours ago), and the app installed on the device, whilst not being signed with the same release key (it's a debug build and key), should work because Android Developers says "you only need to upload your application as a draft application. However, you must sign your application with your release key before you upload it as a draft application. Also, the version number of the uploaded application must match the version number of the application you load to your device for testing". Ie the code on the device apparently doesn't need the same key providing versionCode matches.
My developer console login is - say - a#googlemail.com, and I have a license test address registered (on the developer console) of b#gmail.com. The primary account on my phone is also a#googlemail.com. However I do have a secondary account on there of b#gmail.com. I do NOT want to have to reset my phone and change its one and only account to b#gmail.com.
Android Developers says "The only way to change the primary account on a device is to do a factory reset, making sure you log on with your primary account first" which seems to imply I might have to. It also then says "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" which partially contradicts the first statement. Most of the text on the site appears to apply to pre-V3 code, OS 1.4 etc, so I am not sure how relevant it is.
I notice that Google Play allows me to select the account to use, and both the above show up in the list. Therefore, if I select that second (test) account in Google Play, should that be not sufficient to start testing with that test account?
What actually happens is, whatever account I have selected in Google Play, on starting a purchase I get a message "this version of the application is not configured for billing through Google Play".
Is this because I really do have reset the device and make the primary account b#gmail.com, or because of something else, possibly in the code?
I have some more information now, together with the answer above:
Once I loaded the device with the release signed key the message on a purchase attempt changed to "the publisher cannot purchase own item".
I tried logging in to Google Play with both my accounts and it made no difference. When logged in with the test account I also tried to find the app in the play store. Didn't show up even to the test account (draft app). (I hoped the test account could download it even as draft and therefore following the rules above about multiple accounts I could test purchase with the test account, but no).
Therefore I conclude:
Can only test on a device with an app signed with the same key as the one uploaded to the play store - whatever Android Developers might say.
The ONLY account that can test purchases on a device is the first set (primary) account.
Best therefore to have a completely new account as one's Developer Console account (bit late now).
Would be happy to hear if anyone can contradict the above.
Sign the app you upload to the device with a release key. As far as I know you can't test in-app billing without signing it properly. Actually, last week I tried it as written above and it works.
Hope it helps.
You can have multiple accounts on your devices -- as many as you want. But while testing the app, make sure you don't install it by the app Play Store on your device. Instead, go to Google Chrome, browse to its page on Google Play, and install the app from there. There's a button Install (or Installed).
I guess if you already install the app from account A, then the Android app Play Store will use that account to install next version (or reinstall current version) -- even though you're signed in as another account, like B for example.
However the Google Chrome will just install the app via the current signed in account. This could be a bug and it would be fixed some day. But it's working right now -- when I'm typing this answer. Android team is well known of being lazy for delivering fixes. I hope this "bug" will never be fixed :-)
I am attempting to get google's example (in-app purchasing version 3) test app "TrivialDrive" to work, but have the following problem:
I click the "buy gas" button, this brings up the following screen:
There are two possible interpretations of this message:
The item is unavailable THEREFORE this user can not get it.
The user is somehow not eligible to purchase this item THEREFORE the item is unavailable.
So which is it? And why might I be getting this error anyway?
By the way the app has been uploaded to my developer account yesterday, so I have far exceeded the 2-3 hour wait Google recommends for the data to be in the system.
Also I have "Play Store" installed on the device.
Just for good measure here is a screen grab from my developer account:
I am running the app from a device registered with a gmail address which is on my developer's "Test Accounts" list.
EDIT: I just tested another app of mine which used the old-style (Version 2) billing system and it reported "Please first complete your account by adding a payment method". So it would seem that the lack of payment method was the ultimate cause - but I wouldn't want potential customers to be presented with such a useless and misleading error message. I did a search for "item unavailable" in the MainActivity.java and the strings.xml and found nothing, so am at a loss as to haw to avoid this scenario.
I see that you have yet to publish the overarching app that the in-app product is supposed to stem from. As a result, Google does not allow you to pay for an in-app product if the application itself has yet to be published. Once you release the application and publish it, you should be able to access the in-app product's sales page.
An in-app product will appear UNPUBLISHED until the owning application is published.
Even if you were to publish your in-app product, nobody can buy it until your actual application is.
Have you setup a test account? The test account should not be the your google play dev account.
Explained here
Inching slowly (but methodically) towards my first implementation of In-app Billing, I reached the point in which I can actually run the market billing sample application: The app is signed and uploaded to the AM, the "product list" has been created per the instructions and a test account has been set in both Google and the phone.
But when I proceed (successfully) with a purchase, despite selecting the test account on the AM, I am prompted to confirm the purchase with my real gmail account, to which my real credit card is linked.
When testing PayPal, for example, one can create test accounts, too, with fake CC numbers, to test freely w/o burdening the real CC system.
Is this available (or possible) for In-app Billing development & testing, too?
Update: I tested this on a different device, having only the test account set, and sure enough the Android Market behaves erroneously, responding the following error message:
The item you were attempting to purchase could not be found.
I know that the item is there and that it is set up properly in the Android Market because this error is never issued on the device with the real account with the CC number (there I receive a perfect behavior with the masked CC number, the Total and an Accept & buy button). Why does Google write such misleading error messages?
Update: I found this incredible thread, which seems to partially answer my question. Unless something new has been introduced by Google since then.
You have to use a real credit card. However, you can always refund your test purchases!
Note that you'll have to make the purchases from a test account that's separate from your developer account, since Google Checkout doesn't allow an account to buy from itself.
Test accounts are useful when you upload your application as a draft application,not published.Then using test account you can do even purchase of unpublished application.Hope this helps.