android / play-billing-samples

Samples for Google Play In-app Billing
Apache License 2.0
2.37k stars 1.33k forks source link

In-app purchases with multiple accounts #2

Closed TonyTangAndroid closed 7 years ago

TonyTangAndroid commented 8 years ago

Hey there, there will be issue when users have multiple accounts added in device. This is an issue that everyone who has ever integrated android play billing is experiencing. Please refer to this link https://plus.google.com/+ChrisLacy/posts/BAahtLEw9gy or this link for more details. http://stackoverflow.com/questions/28811490/in-app-purchases-with-multiple-accounts#

ashughes commented 8 years ago

We often get complaints from our users that we've "removed" their purchases. This is obviously very frustrating for both our users and us. For those users that actually email us about the issue (rather than just curse at us in a Google Play review) and follow our instructions, we're usually able to solve the issue (at least temporarily).

I've done some testing and figured out a way to reliably reproduce the Google Play missing purchases bug:

Set up: Sign into a single Google account on a device. Purchase an in-app product or subscription (I tested specifically with subscription).

Steps to reproduce:

  1. Uninstall the app that you made the purchase with.
  2. Add a second Google account to the device.
  3. Open Google Play and switch to the new Google account.
  4. Download the app you uninstalled in step 1.
  5. Open the app and query for purchases. The previous purchase is not reported.

Fix A (only works if the account used to make the purchase is the "primary" account on the device):

  1. Clear the data of the Google Play Store app.
  2. Open the Google Play Store and accept the terms.
  3. Open the app and query for purchases. The previous purchase is reported.

Fix B:

  1. Uninstall the app.
  2. Open Google Play and switch to the account used to make the purchase.
  3. Download the app you uninstalled in step 1.
  4. Open the app and query for purchases. The previous purchase is reported.

A "realistic" example of the above scenario is:

  1. A user makes a purchase in an app with account A.
  2. Sometime later the user gets a new device and signs into both account A and account B.
  3. The user installs the app on the new device while account B is selected in Google Play.
  4. Their previous purchase is not reported to the app even though they are signed into account A on the new device.

I'm sure there are other ways to reproduce this issue (and other "fixes"). I hope this helps resolve this issue.

TonyTangAndroid commented 8 years ago

I have to say that I am disappointed with the fact that this issue has been mentioned at least three years ago(see this link and the link I attached above). And it* could be stably reproduced* and every app developers _are experiencing with issue. And this is related to _real money, this is not an issue that users do not care that much. But still there is no fix. I have logged several android related issues in https://code.google.com/p/android/issues/list, and it usually gets fixed in the next release. I do not know what happened to the In App purchase team. Hope there will be someone who will eventually gets this fixed.

rpattabi commented 8 years ago

I am not clear why google has to support this scenario. As far as google play is concerned, app purchases are specific to an account. If an app is purchased using one account, it won't be possible to utilize that purchase through another account.

Google play has come up with Family Library. This could be the solution for your users with multiple accounts. However if this has to work, I think, developer shall approve the in app purchase to be allowed for family library or not.

brnhffmnn commented 8 years ago

@rpattabi You may be misunderstanding this issue. It's not about accounting one purchase to more than one account. But rather the correct allocation of purchases to the corresponding account, when there are multiple Google accounts set up on the device.

kanetik commented 8 years ago

The original issue includes this: "Open Google Play and switch to the new Google account." And never says anything about going back to the original account (the one the purchase was made from). Perhaps the steps are incorrect, but based on what it says, I think @rpattabi has the correct read.

On Mon, Jul 18, 2016, 8:40 AM Brian Hoffmann notifications@github.com wrote:

@rpattabi https://github.com/rpattabi You may be misunderstanding this issue. It's not about accounting one purchase to more than one account. But rather the correct allocation of purchases to the corresponding account, when there are multiple Google accounts set up on the device.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/googlesamples/android-play-billing/issues/2#issuecomment-233317127, or mute the thread https://github.com/notifications/unsubscribe-auth/AAwn0bIoRdYXsva2hHaNVkDPQ7J8S4iUks5qW3RXgaJpZM4HAyHj .

ashughes commented 8 years ago

When a user has multiple Google accounts on their device, it should not matter which account is currently selected in Google Play. In-app purchases made with any of the signed in accounts should be reported to an app. Unfortunately, this is not the case (as I described above, and provided steps to reproduce the issue).

kanetik commented 8 years ago

I think I'm in the camp of "works as it should." As @rpattabi mentioned, Family Library might help with that, but I'm not sure in-app purchases apply to that.

On Mon, Jul 18, 2016 at 11:57 AM Andrew Hughes notifications@github.com wrote:

When a user has multiple Google accounts on their device, it should not matter which account is currently selected in Google Play. In-app purchases made with any of the signed in accounts should be reported to an app. Unfortunately, this is not the case (as I described above, and provided steps to reproduce the issue).

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/googlesamples/android-play-billing/issues/2#issuecomment-233372736, or mute the thread https://github.com/notifications/unsubscribe-auth/AAwn0QRT1LD-pyzTUn303Lw5oePcWhK8ks5qW6J-gaJpZM4HAyHj .

adennie commented 8 years ago

@ashughes, I'm confused. Is there a missing step 4.5 in your steps to reproduce, where the user opens Google Play and switches back to the original Google Account? If not, why should the purchase made under the original account be visible to the app when running while logged into Google Play as the 2nd account?

ashughes commented 8 years ago

Sorry, but I really don't understand the "working as it should". So if I'm logged into 2 Google accounts on my device, say my personal and work. I have apps installed, some of which I've made in-app purchases with through my personal Google account, and others I've made through my work Google account. Are you saying you think the correct behavior is:

  1. My personal account is selected in Google Play.
  2. I open an app that I've made in-app purchases in with my work account.
  3. My purchases are not enabled.
  4. I open Google Play and select my work account.
  5. I open the previous app and now those purchases are enabled?

First of all, the above is not how it currently works, and it's not even what we're talking about, however this is what it sounds like you're saying is "working as intended", so I wanted to clarify. If this is what you think the correct behavior is, I absolutely disagree. This would cause so much frustration with both users and developers. Users wouldn't know to switch which account is currently selected in Google Play in order to make sure their purchases are enabled in a specific app. And even if they did, it would be annoying to remember to do this constantly if you have, for example, personal and work accounts on you device. As developers, we'd be blamed constantly for losing users purchases since they're suddenly gone when they happen to switch which account is selected in Google Play.

I also wanted to note that this issue has nothing to do with the Family Library (regardless of the fact that, as far as I am aware, in-app purchases are not part of the Family Library).

Just to reiterate, the issue that's being reported here is that if a user is signed into more than one Google account on their device, depending on certain scenarios, their purchases can stop being reported to an app when they should be. This does not always occur. It is possible to be signed into multiple Google accounts on a device, and have in-app purchases made with those different Google accounts, and have all the purchases be reported to apps. This is the correct behavior. However, when certain scenarios occur, such as the steps in my original comment (although that's not the only way), purchases from one or more accounts stop being reported to apps. This is perceived by most users as the developer "deleting" their purchases. Simply switching which account is selected in Google Play does not fix the issue.

kanetik commented 8 years ago

The way you explained it there makes me understand where you are coming from differently. I was picturing multiple accounts on the device, as you would have in a tablet shared by a family. In that case, I think it makes sense that it would work that way.

However, now that I understand better, I do agree that in the case of mirror play accounts signed in at once, then yes, it should work more like you describe.

Sorry for the confusion. That said, I have no power to do anything, your gonna haveb to convince a Googler like you convinced me :)

On Mon, Jul 18, 2016, 12:54 PM Andrew Hughes notifications@github.com wrote:

Sorry, but I really don't understand the "working as it should". So if I'm logged into 2 Google accounts on my device, say my personal and work. I have apps installed, some of which I've made in-app purchases with through my personal Google account, and others I've made through my work Google account. Are you saying you think the correct behavior is:

  1. My personal account is selected in Google Play.
  2. I open an app that I've made in-app purchases in with my work account.
  3. My purchases are not enabled.
  4. I open Google Play and select my work account.
  5. I open the previous app and now those purchases are enabled?

First of all, the above is not how it currently works, and it's not even what we're talking about, however this is what it sounds like you're saying is "working as intended", so I wanted to clarify. If this is what you think the correct behavior is, I absolutely disagree. This would cause so much frustration with both users and developers. Users wouldn't know to switch which account is currently selected in Google Play in order to make sure their purchases are enabled in a specific app. And even if they did, it would be annoying to remember to do this constantly if you have, for example, personal and work accounts on you device. As developers, we'd be blamed constantly for losing users purchases since they're suddenly gone when they happen to switch which account is selected in Google Play.

I also wanted to note that this issue has nothing to do with the Family Library (regardless of the fact that, as far as I am aware, in-app purchases are not part of the Family Library).

Just to reiterate, the issue that's being reported here is that if a user is signed into more than one Google account on their device, depending on certain scenarios, their purchases can stop being reported to an app when they should be. This does not always occur. It is possible to be signed into multiple Google accounts on a device, and have in-app purchases made with those different Google accounts, and have all the purchases be reported to apps. This is the correct behavior. However, when certain scenarios occur, such as the steps in my original comment (although that's not the only way), purchases from one or more accounts stop being reported to apps. This is perceived by most users as the developer "deleting" their purchases. Simply switching which account is selected in Google Play does not fix the issue.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/googlesamples/android-play-billing/issues/2#issuecomment-233389027, or mute the thread https://github.com/notifications/unsubscribe-auth/AAwn0TmY4EaZoBkJsyHkFIAktunn9V-Xks5qW6_UgaJpZM4HAyHj .

ashughes commented 8 years ago

Glad I was able to explain it well enough. :)

I've been trying to convince a Googler. I spoke with 2 people at I/O this year, both of whom said they'd look into the issue, but I haven't heard back from either. :'(

laurencedawson commented 7 years ago

This issue has to be one of the longest running issues I've encounter and responsible for 90% of all complaints from my users...

TonyTangAndroid commented 7 years ago

And I am so disappointed that In-App team has no plan to fix it.

laurencedawson commented 7 years ago

Has anyone made any progress with this?

Seems more common to have multiple accounts and I'm getting a lot of support emails asking why they've lost their in-app purchases.

ashughes commented 7 years ago

Had a very promising conversation with some Googlers on Twitter: https://twitter.com/chrisbanes/status/771708081294237696. But I haven't heard whether or not they're looking into the issue. :-/

laurencedawson commented 7 years ago

Thanks for the update @ashughes.

Every update I push I'm getting constant negative reviews as folk think I'm trying to charge them again. This is getting beyond annoying now...

ashughes commented 7 years ago

Same here... :'(

abiemann commented 7 years ago

this issue is 4 years old now !

see the date... http://forums.androidcentral.com/market-help/204265-help-please-how-do-i-change-accounts-app-purchase.html

dakdroid commented 7 years ago

This is so frustrating: https://goo.gl/photos/PH7cRddzEuQYi28n8

Feel free to copy/paste my workaround (replace app name): http://pastebin.com/xAmQACy7

laurencedawson commented 7 years ago

Any update on this? My users are still losing their purchases each update I push...

chrisjenx commented 7 years ago

I've just run into this problem, it's not funny. These three images also show how confusing it is to ME as a developer! Heck knows how a unknowing user will work this out!

https://goo.gl/photos/kzwP36B3DVFPXU3UA

If you aren't going to fix it, you need to make it REALLY clear which InAppPurchase is associated to which account.

TonyTangAndroid commented 7 years ago

This issue is getting ridiculous. It has been existed for five years. And there is no response from the In-App pay team.

casolorz commented 7 years ago

Is there no way to tell the billing code to use a certain account?

This issue is such a pain. Every time I release an update I get several bad reviews and emails from people who are justifiably upset.

The issue is really bad when doing a staged rollout because if a user has multiple accounts, the one that gets "lucky" and gets the update isn't necessarily the one that they made the in-app purchase with.

laurencedawson commented 7 years ago

Can anyone from Google update us on this issue?

monstermac77 commented 7 years ago

We're hitting the same problem. It has been very frustrating for us as well as our users. Our experience with In-App purchases on Android has been horrendous compared to iOS.

Artaud commented 7 years ago

Many thanks to @dakdroid I have just tested your workaround with a customer and it works! Saving us TONS of hassle as this is the most common issue with our app.

netomarin commented 7 years ago

Thanks for all comments. Because this issue is not exactly related to this sample, I'm closing the issue. Next time you have technical question, feel free to make a question on Stackoverflow and use the tags google-play, in-app-purchase or in-app-billing. We are trying to address as much question as possible in Stackoverflow.

Best regards

casolorz commented 7 years ago

@netomarin this has been asked before on stackoverflow.com on multiple posts, here are two I quickly found on my phone.

https://stackoverflow.com/q/29885959 https://stackoverflow.com/q/28811490

TonyTangAndroid commented 7 years ago

This is an issue that could be stably reproduced and have existed for almost five years. Indeed the root cause is not from the Sample. It is from the library itself. Hopefully the in-app pay team could realize such issue and have an internal record that is tracking this issue. Otherwise I feel it is not going to be resolved forever....

ashughes commented 7 years ago

@netomarin This issue is also a bug report, not a question. There is no public bug tracker for in-app billing or Google Play Services (that I'm aware of at least). :-\

As you can see from the conversation above, this is a much better place than SO for discussing this issue. SO does not really allow for conversations except through comments on answers...and the only answer here is for the issue to be fixed in Google Play.

I reported this issue to a few more Googlers this year at I/O, so I'm really hoping this will get some traction internally. I've also talked to Googlers who've experienced this issue first hand, so if you're one of those, please please bug people on the Play Billing team to fix it!

netomarin commented 7 years ago

Hi @ashughes

You can reach our support team by the Google Play Console. After logging in, click on the ? at the top right corner and contact us via live chat or e-mail.

And also, I'll check this internally.

Thanks

casolorz commented 7 years ago

@netomarin I've actually reported this issue to the play store console support before and was told they don't handle coding issues.

gorgon commented 7 years ago

Actually this issue was already resolved for license testers, so developers don't need to worry about license check for all of their accounts that were added as license testers anymore. To add a license tester account please follow this doc: https://developer.android.com/google/play/billing/billing_testing.html#testing-purchases

For all the other accounts to switch the ownership, instead of removing all the accounts, you can just follow these 3 steps:

  1. Uninstall the app from your device, that you want to change the ownership for
  2. Open https://play.google.com/store from the browser and log into the account you want to own the app
  3. Find and install this app into the device from step 1.
casolorz commented 7 years ago

@gorgon that workaround works well but it is less than ideal for a large user base.

gorgon commented 7 years ago

@casolorz , I agree. But do you have any idea, how to gracefully handle multiple accounts? The solution should be convenient for the users and prevent abuse in the same time.

casolorz commented 7 years ago

Either the play store needs to try its best to install it under the right account and prevent updates from messing that up or the in app purchase code should let us developers ask the user which account they want to use.

gorgon commented 7 years ago

Unfortunately, it's impossible to figure out, which account is right for the particular app, since the same app could be installed from any account. So the account that installed the app is considered the owner. And asking the user to select from which account to launch the app opens a door for a potential abuse.

ashughes commented 7 years ago

Or the Play Store should report purchases from ALL signed in accounts (my preferred solution).

As an enhancement, I think the Play Store purchase flow should also allow users to choose which account they want to use to MAKE a purchase, in case they used the "wrong" account to download the app (rather than having to uninstall and reinstall the app).

casolorz commented 7 years ago

I was actually thinking the developer would ask the user which account they want to use.

What abuse are you referring to?

abiemann commented 7 years ago

I agree, the user needs to be given a choice with what account to make the purchase if there's multiple users on a device. I think the Play Store dialog should by updated to provide this feature. I don't see how there's potential for abuse if the account with access to the money uses authentication (by Password, PIN or fingerprint)

laurencedawson commented 7 years ago

There 100% has to be some way to allow the user to pick if they have multiple accounts on their device.

This level of oversight is remarkable on the behalf of Google and I'm constantly getting emails from users wondering why they've lost their purchases. Telling them to reinstall from their browser is totally unacceptable.

casolorz commented 7 years ago

I've gone ahead and created a new issue on stackover for this to see if we get an answer there https://stackoverflow.com/questions/44397765/play-store-updates-installs-app-using-a-different-account-than-the-one-the-user

netomarin commented 7 years ago

@casolorz @laurencedawson @abiemann @ashughes Thanks for all details. I'm already addressing this issue with our internal teams, and as soon as I have an answer or a feedback, I'll update this thread and stackoverflow question.

Just to make clear, I didn't close the issue because it's irrelevant, but because I'm trying to keep only issues related to the sample code staged in GitHub.

Thanks, Neto.

ashughes commented 7 years ago

@netomarin Very glad to hear it! Thank you.

miken32 commented 7 years ago

@netomarin please do not encourage your users to spam Stack Overflow with off-topic questions. On-topic questions for SO are specific programming problems with concrete solutions. As @ashughes rightly points out, this issue cannot be "answered" by anyone.

netomarin commented 7 years ago

@miken32 it's not spam, and this is not a SO specific question, it's feature related. Now, this is working as designed, but it can be addressed with workarounds if the developer want to work with multiple accounts and based on many developers feedback, we are working to see how we can improve this experience.

And, as I mentioned, this issue was closed because is not related to the sample. Thanks

ashughes commented 6 years ago

@netomarin With all due respect, while you may consider this "working as designed", this isn't a feature request, it's a bug report. While there are definitely related things that may be feature requests (such as adding an account picker to the Google Play dialog), fundamentally, users (and developers) expect the behavior of the API to report purchases consistently.

We just released an app update this week and, right on queue, a new round of support emails are rolling in with users who no longer have access to purchases. Very frustrating (for us and them).

Any update? ;-)

As an aside, Google Play In-App Billing desperately needs its own issue tracker (especially now that it's going to be a gradle dependency).

citydelver commented 6 years ago

I have a slightly different case to add: I sideloaded an app (installing it directly from its APK file), because the Play Store version doesn't have all features available in its GitHub version, and now I want to make an in-app purchase, but the popup/dialog shows I'll buy through my secondary (work) account, which is not the one I want to use and is the one in which I have no credit card. Not only there's no way I can change the purchase account, but can't even use the workaround to solve it, since it wasn't installed through the Play Store in first place! So what seems to happen in cases like this is that Play Store assigns a(n apparently) random account for purchases in sideloaded apps, and there's no solution nor workaround. PS.: at https://stackoverflow.com/questions/29885959/in-app-purchase-uses-wrong-account-after-update user a.bertucci says "if you sideload the apk then the account owning the app will be the first Google account created on the device", but that isn't true, as my personal account was the first one created in the device.

bumbaras commented 6 years ago

As alainsr asked, how to set default account (among multiple accounts) for sideloading applications? About sideloading and the reasons to use it:

abumoallim commented 6 years ago

I am having an application Name X with Google Sign In. Everything works on user-selected google account while logging.

Now if suppose user have 3 Google accounts on his/her phone say A, B, C. Now account A is connected to google play store. As a user, if I logged in with Account B in my X App and When I will make a In-App purchase, it will Make a purchase on Account A automatically as it is connected to my Play Store (Downloaded App with Account A but Logged in with B in my X App).

Now I want some means to connect this purchase with Google Account B rather than any other i.e. with Account I am currently Logged in within X App. Please respond me as soon as possible. I have a pending app to release as early as possible. Thank you