Get Already Purchased Product Data From App Store

Have you ever wanted to get previously brought product data(in app purchase) from app store while developing iPhone applications ??? Well, I wanted once. The application contained several products. And we needed to get those product details in a case user moves to a new device or he has couple of devices (iPhone, iPad) having the same app.

The answer is as follows, first you need to use the function

– (void)restoreCompletedTransactions

in SKPaymentQueue class. But your products need to be configured as non-consumable in app store.

After the transactions are delivered, the payment queue calls the observer’s

– (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue

method. If an error occurred while restoring

– (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error

will be called.

After that you can check

@property(nonatomic, readonly) SKPaymentTransaction *originalTransaction

for each transaction and get the product id.