Question

I am currently implementing In-App Purchase and have just read a few posts saying that a Restore Purchases button is required or apple will reject app.

I don't want to add a second button to my UI design.

So my question is...

Is there a way of checking if a user has previously made the in app purchase. before deleting and re-installing the app?

obviously NSUserDefaults would be wiped on delete so I can't use that.

if (//*CHECK IF PREVIOUSLY PURCHASED*) {

    [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
    [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];

} else {

    SKPayment *payment = [SKPayment paymentWithProduct:product];
    [[SKPaymentQueue defaultQueue] addPayment:payment];

}
Was it helpful?

Solution

Without the user actually putting in their details their is no way to know if they have purchased the item. So you would need a button to invoke the purchase/restore action.

Yes Apple will reject your application if you do not have a restore button. I know first hand!

If you are opposed to having two buttons you could just make one button which states check for previous purchases, if it returns nothing then change it to a purchase button. But yeah the UX on that is not too good.

Have your normal Purchase button as your UI is designed but then put a restore button in a "settings" portion of your app. The buttons don't need to be next to each other and from what I can see this is the pattern that most apps use.

Side Note

If you have a server side implementation and your application uses some kind of login identifying the user you could track their purchases server side, when they log in again and they have previously purchased items you could trigger the restore process, If I recall correctly though the user would still have to input their Apple ID to restore with this process.

OTHER TIPS

Inapp purchase the user will not buy anythingin the app on that case user click the Restore purchase it want to display a alert message

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top