Sridhar
Sridhar

Reputation: 2228

iOS:InApp Purchase: Best way to show restore button

Is "Restore Purchase" button mandatory for iOS App submission. I have included Auto-renewable purchase in my application. I am showing the purchase screen First then only user can use my application.

if "Restore Purchase" button is mandatory, I need to show that button when it is required right?. so Is there any way to find out when "Restore Purchase" button should show?

Or else , can we show "Restore Purchase" button without considering whether user already purchased or not

FYI,

I tried to get the receipt from the Bundle.main.appStoreReceiptURL. Then I tried to verify the receipt. If It is successfully verified, I know the user has purchased or else I will show the purchase screen

Is it correct?

Upvotes: 0

Views: 234

Answers (2)

Shankey
Shankey

Reputation: 61

When user had purchased your app earlier and due to some reason he/she has uninstalled from his/her device or he/she wants to install in some other device with same apple ID(In order to enjoy purchased benefits). Over here, restore button comes into picture. Whenever we install an app from appstore, sometimes purchase verification get fail and app show itself in a normal form so overcome this situation(or any other where purchase has failed and user feels that it is being purchased), apple has asked the developer(you can see this thing in their documentation also) to provide a restore button.

Now coming to your point "I tried to get the receipt from the Bundle.main.appStoreReceiptURL. Then I tried to verify the receipt. If It is successfully verified, I know the user has purchased or else I will show the purchase screen"

As long as you are taking the receipt data from this URL(appStoreReceiptURL) and verifying it correctly(hope you are verifying it from the apple server) everything else is fine. On the basis of that you can show or hide the restore button.

Upvotes: 0

matt
matt

Reputation: 535222

can we show "Restore Purchase" button without considering whether user already purchased or not

The whole point of the Restore Purchase button is that you are in a situation where you don't know whether the user has purchased. Only the Store knows that, and you have to let the user communicate with the Store through your app.

So, if you know that the user has purchased, fine, you know it, and there is no need for a purchase dialog / offer or a Restore button. But if you don't know it, then you know nothing. Any time you offer the user a chance at a purchase, you must offer a Restore button as well.

Upvotes: 1

Related Questions