How to check if an IAP product is already bought

Hi,

I have three non-consumable products. If I understood correctly, after purchase I save the info to a file that the product is bought. I can then remove the product from the ui checking the file if the user has bought the product. But can I some how check this from the App Store? Is the file neseccary?

And if the user has bought one of the three products, wipes his/her phone and restores products. How can I check what products where restored? For example if the user starts the restore process, I wipe the data from the file where I saved info about the bought products… but then I don’t know how to check what products are restored?

BR

Tommi

Look at the store.restore() API. It will return a list of all non-consumable purchased items. Apple requires this be on a button in the interface. Google doesn’t care and after a short delay (a second or two) after initializing the store, you can call store.restore().

For Google you will get new “purchased” items. For Apple, they come in tagged as “restored” in the transaction handling function.

Rob

Thanks Rob!

I assume when restore is called, I get event.transaction.productIdentifier and I compare it to product identifiers that are set in iTunes Connect.

But what about checking if the product is already bought? I can do it using my files, but is it possibly to check from the App Store?

store.restore() will only return previously purchased items to you. That’s what it does.

Look at the store.restore() API. It will return a list of all non-consumable purchased items. Apple requires this be on a button in the interface. Google doesn’t care and after a short delay (a second or two) after initializing the store, you can call store.restore().

For Google you will get new “purchased” items. For Apple, they come in tagged as “restored” in the transaction handling function.

Rob

Thanks Rob!

I assume when restore is called, I get event.transaction.productIdentifier and I compare it to product identifiers that are set in iTunes Connect.

But what about checking if the product is already bought? I can do it using my files, but is it possibly to check from the App Store?

store.restore() will only return previously purchased items to you. That’s what it does.