How can I get the product identifier from a restored transaction?

SWIFT VERSION:

Once you get the delegate

func paymentQueueRestoreCompletedTransactionsFinished(queue: SKPaymentQueue!) {
    var productIds = [String]()
    for transcation in queue.transactions{
        if let productID = transcation.payment?.productIdentifier{
        productIds.append(productID)
        }
    }

if you mean you want to check the purchased items that already user buy it .. yes you can do like this

- (void) checkPurchasedItems {
    [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
} //You Call This Function

//Then this delegate Function Will be fired
- (void) paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {
    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];
    }
}