Search code examples
c++cocos2d-xsoomla

Cannot restore lifetimevirtualgood item that was given as a gift


I use this method

soomla::CCStoreInventory::sharedStoreInventory()->giveItem(REMOVE_ADS_ITEM_ID, 1);

to give player one remove-ads item. After that, player remove and reinstall app again and click on Restore Purchase button but no remove-ads item is restored.

I'm so confused that given item cannot restore or there are somethings I missed? Please help.


Solution

  • The restore functionality works by looking up what IAPs the user owns (on the App Store/Google Play/etc.), and gives each non-consumable locally so that Soomla knows about it.

    Since you're just giving the item locally directly, restore items has no idea that the item was granted (since you're wiping the data that says it was). It's still only looking at the official stores.

    What you can do is sync what items the user owns to the cloud, and restore from that, using a UID. If you want complete control, this is the best bet, but that involves your own servers and coming up with a way of generating UID purely from device information, and not one-size-fits-all. Then you'd give the items locally when you can verify that the same user owns it on your server.

    But there is an easier way. Soomla has an official implementation where they do all of this for you: Grow Sync.

    Update (May 2016): Soomla is now shutting down Grow Sync, Highway, etc. so you can no longer rely on those services.