“You already own this item” but getPurchases is empty [duplicate]

为君一笑 提交于 2019-12-10 04:29:04

问题


I purchased a subscription (not a Managed Product or Unmanaged Product) yesterday to test, I refunded myself and then cancelled the subscription. After the refunding and cancelling, when I call:

m_billingService.getPurchases(3, m_context.getPackageName(), ITEM_TYPE_SUBS, null)

It would return my purchase with a purchase state of 0 (valid/ok). Today when I call the same method, it returns nothing. Yet when I try to purchase the item, google play store responds that I already own the item.

I've already restarted the android device, cleared the google play services cache and ensured only the test account is activate on my phone (i.e., I removed my google developer account).

The question has been asked before but always under the context of products and not subscriptions. The answer for those posts seem to be to "consume" the product; subscriptions are not consumed.


回答1:


I am fairly certain that what you are trying to do is not possible the way you are trying to do it. As I am not sure the subscription length, it is possible that to Google you are indeed still an owner of the subscription, because it remains active for the remaining period even if you initiate a refund.

This allow users to get a refund from the purchase but also still receive the service. This would be at the app owners discretion. This can be a good strategy if you want to handle a user with a valid complaint but also allow them to maintain access until you can fix their issue or complaint. It could also help to minimize the effect of poor ratings.

In order to do what you are wanting you need to revoke the subscription, and that will immediately terminate it. After this calling m_billingService.getPurchases() should work correctly.

Documentation




回答2:


When you cancel and/or refund a subscription purchase, the subscription is not immediately terminated -- it remains valid until its expiration time.

Instead, you have to revoke a subscription purchase in order to provide a refund and immediately terminate the subscription.

See this section of the Google Play API Reference for more info on the cancel, refund, and revoke methods.



来源:https://stackoverflow.com/questions/25694829/you-already-own-this-item-but-getpurchases-is-empty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!