I have a quick question Rob.
You say that “store.restore() will instruct the store to provide you a list of items that person has purchased”
I read in the docs somewhere that iOS returns a “restored” state, but Google doesn’t - it returns “purchased” again.
How would this work in regards to consumable items (e.g. in game currency)?
If the user bought a set of levels, and 100 coins - I would only expect the levels to be restored, not the consumable coins. Since I’m still at the beginning of setting up IAP, I’d be interested to know how this is handled. Are consumables not returned in the restore function? If they are, then that makes restoring on Google Play very difficult, since we’d need to differentiate between a real purchase event and a “purchased” event triggered by store.restore().
Also (while we’re on the subject) I’ve posted before that there are no full IAP tutorials, though there are some that cover a lot of the info, and we have the sample app. However none of these explain what to actually do once the purchase has all gone through successfully.
I presume that it would be something like
function transactionCallback( event ) if event.transaction.state == "purchased" then if event.transaction.productIdentifier == "mycompany.mygame.consumableOne" then coinTotal = coinTotal + 100 --then save coins locally / on server end end end
Is that correct? I find it a bit odd that no one has mentioned it in any of the tutorials, maybe it’s super obvious but when you’re dealing with something as complicated (and potentially costly if you do it wrong) as this there should probably be a full on tutorial covering this somewhere. If there is one and I’ve missed it then please ignore my ramblings