Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In app purchases restore Button

I have implemented in app purchases into my app update for the first time, only too wait 3 weeks and have it rejected for the following reason:

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.

Now I was thinking of adding a navbar button to the right (top) of my table where the app purchases can be seen/tapped and adding the following code that will be linked to the button:

 [[SKPaymentQueue defaultQueue]   restoreCompletedTransactions]; 

Can someone verify that this is correct and most likely all that is needed? Would like this to pass successfully this time. Thanks in advance!

like image 788
Alex G Avatar asked Jun 13 '12 19:06

Alex G


People also ask

What does the Restore Purchases button do?

Restoring purchases prevents you from losing all the things that have been purchased on the old devices.

Can in-app purchases be restored?

To restore your purchases:Open the drawer from the upper left corner of the screen and select Support. Select Purchases and Paid App from the menu. Tap on the menu option, located in the upper right-hand corner of the screen. Tap on Recover Paid App.


1 Answers

I use a variation of this:

//inside of an IBaction [[SKPaymentQueue defaultQueue] addTransactionObserver:self]; [[SKPaymentQueue defaultQueue]restoreCompletedTransactions];   // Then this is called - (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {     NSLog(@"%@",queue );     NSLog(@"Restored Transactions are once again in Queue for purchasing %@",[queue transactions]);        NSMutableArray *purchasedItemIDs = [[NSMutableArray alloc] init];     NSLog(@"received restored transactions: %i", queue.transactions.count);      for (SKPaymentTransaction *transaction in queue.transactions) {         NSString *productID = transaction.payment.productIdentifier;         [purchasedItemIDs addObject:productID];         NSLog (@"product id is %@" , productID);         // here put an if/then statement to write files based on previously purchased items         // example if ([productID isEqualToString: @"youruniqueproductidentifier]){write files} else { nslog sorry}     }   } 

Sorry, I'm on my iPad if this makes no sense.

like image 71
Brian Noah Avatar answered Sep 21 '22 15:09

Brian Noah