Youddh
Youddh

Reputation: 1531

In app purchase displays message "you already own this item." in android

I am trying to implement in-app. In android, in-app is working perfectly.But, when I remove the app from device and reinstall it, then after if I try to purchase, it displays this message (product is Managed and in-app API Version 2)

enter image description here

and in log, I have an error RESULT_DEVELOPER_ERROR , then I googled and I found the Version 3 has more number of response codes like BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED

So if product is already purchased, the response must 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 ?

Upvotes: 9

Views: 6612

Answers (3)

Nick
Nick

Reputation: 3435

I ended up with calling BillingService.restoreTransactions() after catching RESULT_DEVELOPER_ERROR. Looks odd, but works fine.

Upvotes: 3

Sanket Kachhela
Sanket Kachhela

Reputation: 10856

if you want force to buy product by every time then product should be Unmanaged.

Products can be of 3 types

1) Managed

2) Unmanaged

3) Subcription

Managed means google it self keep record. so by using same email id user not have to paid its charge e.g. remove ads

Unmanaged means user have to buy every time and will be a charged. e.g. Pocker chips

This 2 example i have read on developer site..

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

Upvotes: 11

jawsware
jawsware

Reputation: 924

Have you looked into RESTORE_TRANSACTIONS?

I had pretty much the same problem you describe above. My code is, for the most part, taken from the Market Billing Sample Application.

I added a RESTORE button to my purchase activity which calls the BillingService.restoreTransactions routine.

If you search for RESTORE_TRANSACTIONS within this page: https://developer.android.com/google/play/billing/v2/api.html, you'll find that calling that routine re-triggers the PURCHASE_STATE_CHANGED broadcast.

Which, in my code, triggered the onPurchaseStateChange routine and it worked the same way it would on the initial purchase with the PurchaseState was set to PURCHASED.

Upvotes: 4

Related Questions