question

vikaspandita avatar image
vikaspandita asked

Restore purchased items

In the method onPurchaseUpdatesResponse(), I am getting empty lists for : Set receipts = response.getReceipts(); Set revokedSkus = response.getRevokedSkus(); I have purchased few items and I can see them in AmazonSDKTester app. The userId obtained from: response.getUserId(); is also the same as displayed in the AmazonSDKTester app. I am not able to figure out, why this is happening. All I want to do is restore purchased items, read a lot of stuff trying to achieve this, but I am not able to do it, please please help! Thanks in advance.
iap
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Vikas, Please note that onPurchaseUpdatesResponse() callback will not return any consumable information, you must make a call to PurchasingManager.initiatePurchaseUpdatesRequest() even if your app only contains consumable items. In this case, it is onPurchaseResponse() which will be returned to your app if there are any pending consumable purchases when PurchasingManager.initiatePurchaseUpdatesRequest() is called. When the PurchasingObserver.onGetPurchaseUpdatesResponse() callback is triggered, process receipts returned by fulfilling and enabling all entitlements returned and process any revoked skus.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

vikaspandita avatar image
vikaspandita answered
Thanks Sujoy for the response, but this didn't solve my problem. But, you tried to help, I really appreciate it. There is some more information that I should share with you to make my problem clear here. I am having Entitled items only. I use the following code to initiate the Purchase Updates Request: Offset offset = purchaseDataStorage.getPurchaseUpdatesOffset(); PurchasingManager.initiatePurchaseUpdatesRequest(offset); and I am doing this in onGetUserIdResponse() method when the case is SUCCESSFUL. And I am storing the offset value in onPurchaseUpdatesResponse() when the case is SUCCESSFUL: Offset offset = response.getOffset(); purchaseDataStorage.savePurchaseUpdatesOffset(offset); I am just guessing here that I am doing something wrong in storing the offsets. Anyway, Happy New Year to you and as your name has JOY in it, may this year be filled with so joy for you.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Vikas, Thanks and wish you a very happy 2014 ahead :) When you purchase an [b]Entitlement [/b] and come out from app and launch sdk tester to cancel the transaction and then again go back to your app, you would be notified about the sku revocation for only once. And to receive it, you are supposed to call initiatePurchaseUpdates() from onResume() (to ensure when ever you are launching or resuming the app, you are getting the latest updates about your purchased items) and you would get a call back to the onPurchaseUpdatesResponse() of your observer class. Once the revoked sku and receipts of purchased items are delivered to your app, the Que would be flushed and if you call initiatePurchaseUpdates again without any transaction, onPurchaseUpdatesResponse would return empty lists of receipts and revoked sku. So once you are notified about revoked sku, you need to update your items inventory status, so that the revoked item is made available for further purchase. Please note, if you find any sku in the receipt list of onPurchaseUpdatesResponse, that is not delivered to user, you are supposed to update the items inventory to credit the item to user (this way the fail over should happen for a transaction which was successful but unable to notify your app through onPurchaseResponse due to network disconnect, power loss, or similar). Hope this clears up your understanding. Thank you for writing back.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.