0

I've working code to make or restore purchase. I'm able to buy and restore.

My idea is to put two buttons on purchase screen: "Buy" and "Restore".

I want to eneble/disable those buttons depending on purchase status.

Simply:

  1. If user not bought yet -> "Buy" enabled and "Restore" disabled

  2. If user bought alredy -> no purchase screen :)

  3. If user bought alredy and reinstal app - "Buy" disabled and "Restore" enabled

Of course I'm using standardUserDefaults but problem starts whe user reinstal app. My question is how to get purchase status from appStore (purchased or not yet)?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Maciek
  • 161
  • 3
  • 11

1 Answers1

0

You shouldn't do this because Apple requires to always have a restore button or your app will get rejected.

You also shouldn't disable or hide the buttons depending if something was bought or restored. If the user presses the buy button on a product he already bought he just gets the product for free again, you are never charged twice.

So I wouldn't even bother trying to do this. It also properly makes your users experience more confusing. Better to have a consistent shop experience that doesnt change all the time. Also users might be thinking there is a bug in your game because all they see is a button that doesnt work.

Maybe put a little tick or something next to the buy button if you want to indicate to the user that he already bought the item. You must have some sort of bool or other property that gets set, and saved in NSUserDefaults, once a product was bought. Just use that property to add or remove the tick/indicator.

If you are wondering how to handle the restore button on first press you should use the restore completed delegate method. There you can basically show 2 UIAlertControllers. 1 if nothing restored because nothing was previously bought and 1 that the restore was successful. Check this question I have answered recently for sample code. Restore Purchase : Non-Consumable

"We found that your app offers In-App Purchase/s that can be restored but it does not include a "Restore" feature to allow users to restore the previously purchased In-App Purchase/s. To restore previously purchased In-App Purchase products, it would be appropriate to provide a "Restore" button and initiate the restore process when the "Restore" button is tapped"

Community
  • 1
  • 1
crashoverride777
  • 10,581
  • 2
  • 32
  • 56