In app purchases restore Button

Alex, i've been rejected for the same reason last week, and this is right what Apple wanted - after adding such a Restore button they didn't ask any other question on this subject.

Of course, you need not only to call [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];, but implement the restoring itself too (i mean, providing the content to user).


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.


This is because you can be signed in with the same Apple ID on different iOS devices.

For example, let's say I'm logged into [email protected] on an iPad. When I download your application, I realize that I would like to remove the ads, so I pay 99¢ to remove them.

A year later, I decide to buy an iPhone, and sign into [email protected] on that account, and I download your app again. However, the ads are still there, even though I already paid to remove them on my iPad. That's where the restore feature comes in. Using that, I can restore the purchases that I made on my iPad, and make them work on my iPhone.

To restore the purchase, you could use:

[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];

This causes the

(void) paymentQueueRestoreCompletedTransactionsFinished: (SKPaymentQueue *)queue

method to be called. Inside of that, you need to provide the user with the content that they bought.