In the Purchase application, the message "you already have this item" is displayed. in android

I am trying to implement an in-app. It works great in an Android app. But when I uninstall the application from the device and reinstall it, then after I try to buy it, it will display this message (product is Managed and in-app API Version 2)

enter image description here

and in the log I have a RESULT_DEVELOPER_ERROR error, then I googled and I found that in Version 3 there are more response codes, for example BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED

So, if the product has already been purchased, the answer should be like BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED , and this is not possible in version 2.

Then what should I do? Do I need to implement version 3?

+6
source share
3 answers

If you want to make a product buy every time , then the product must be unmanageable .

Products can be of three types

1) Managed

2) uncontrollable

3) Signing

Managed means that it automatically records a recording. therefore, using the same email id, he does not have to pay his payment, for example. remove ads

Uncontrollable means that the user must buy every time and will be charged. e.g. Pocker chips

This example 2, which I read on the developer's site.

and send out http://developer.android.com/google/play/billing/billing_admin.html

+11
source

Have you looked at RESTORE_TRANSACTIONS ?

I had almost the same problem as you described above. My code, for the most part, is taken from the Market Billing Application Example .

I added a RESTORE button for my purchase operation, which calls the BillingService.restoreTransactions procedure.

If you search for RESTORE_TRANSACTIONS on this page: https://developer.android.com/google/play/billing/v2/api.html , you will find that calling this procedure will restart PURCHASE_STATE_CHANGED broadcast.

Which in my code launches the onPurchaseStateChange procedure, and it works the same way as it was set to PURCHASED during the initial purchase with PurchaseState .

+4
source

I ended up calling BillingService.restoreTransactions() after catching RESULT_DEVELOPER_ERROR . It looks weird, but it works great.

+2
source

All Articles