-
-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore Purchase - iOS #3
Comments
We wil update soon. Maybe before 2018. |
@JJMoon @dooboolab
|
@KjellConnelly
Hope my answer helps you. Thank you. |
@dooboolab Thanks for the reply :) Could you help me understand a bit better how the process works for Android? I am coming from an iOS background, so I will use iOS terms to try to make sense of this. Imagine the situation where I have two IAPs
In iOS, I would first query for the product IDs, then call the buy function. This returns Promise once the buy function has completed (success or failure). On iOS, I would do something with LocalStorage such as setting a saved object: if (item.productId == 'com.website.100coins') {
savedData = {
coins: savedData.coins + 100,
premium: savedData.premium
}
} else if (item.productId == 'com.website.premium') {
savedData = {
coins: savedData.coins,
premium: true
}
} And then I would have a Restore button, and when you tap it, the Restore function is called, which returns the non-consumable purchases that the user has made in the past using that iTunes account. For Android, it looks like I query for the productIds just as on iOS. And when the purchase happens, I also save to LocalStorage. But if I remember correctly, I need to then tell Google Play that the consumable has been consumed (for the coins, and once I save to local storage). But when it comes to the Restore Button, I'm a bit confused. By your description, it looks like those two functions do the following: getPurchasedItemsAndroid(): This will return probably an array of IAPs that this user has purchased using your app. This will include all consumable, and non-consumable purchases. In my case, where I have Coins and a Premium Version, I would just iterate through this array to check to see if the user has bought the Premium Version before when they tap the Restore Button, right? And if its there, then I just set refreshPurchasedItemsAndroid() I don't really understand what refreshing does in this case. Does it tell Google Play that all of the previously consumed purchases are still purchased, but not consumed anymore? Or does it refresh the app's list of purchased items from Google Play's servers in which case would mean that the user's device is saving some sort of data on its own when a purchase is made? Finally, it seems like on iOS, you are required to have a Restore Button for non-consumables. But for Google Play, you CAN have a Restore button for non-consumables, but it would be best practice to just check using Sorry for the long essay. Just having trouble making sense of the IAP process on Android. |
Sorry that I've missed this. I've not implemented Sku.Type option to get consumable products in android since this was our above our topic as explained. Before you could only getPurchasedItems lists for non-consumable products only. I just fixed this to support for querying both consumable and non-consumable products. --------------------------- screenshots done ----------------------------------- Also for refreshPurchasedItemsAndroid method, I've updated support for conusmable products. Screenshots are below --------------------------- screenshots below ----------------------------------- --------------------------- screenshots done ----------------------------------- I've just commited this update. Hope this helps your question. Now you can call getPurchasedItemsAndroid(type: string) function to get non-consumable items or consumable items. If you want non-consumable items just put null or any string. If you want consumable items put 'SUBS' in it. You can use refreshPurchasedItemsAndroid(type: string) function same as described above. |
I’m a bit confused now - I thought .SUBS was for subscriptions (which is different than consumables and non-consumables) |
Yes! It was about items for subscriptions. OMG... I was confused too. Thanks again to point that out. Sorry that I was confused by busy work .. It seems we've been missing some support for this senario. We didn't actually distinguish between consumable and non-consumable product in our library. Since you need this part, we will support for this near future. Thanks for sharing. |
@dooboolab If you have time, could you add Restore Purchase support for iOS? Will be needing it soon and was hoping this feature to be implemented by 2018. Thanks! |
@KjellConnelly |
Restore function Implemented. NPM module will be updated soon. If you need it right now, just use it from GitHub. Version is 0.1.16. It was merged to master, so you can use it right away. |
Thank you!! I really appreciate it :) |
@KjellConnelly |
But how to use it? |
I wanted to create a new issue, but since the SUBJ I'll just post it here (Restore Purchase on iOS) |
Any updates on iOS restore purchase feature?
The text was updated successfully, but these errors were encountered: