How do I check if a product has already been purchased by the user on iOS?

Posted on

Question :

Well, when I want to validate if a product from my application (an InApp) has already been purchased by the user, in Windows Phone, I only have to verify the product through LicenseeInformation. For example:

var license = CurrentApp.LicenseInformation.ProductLicenses["id_do_meu_produto"];
if (!license.IsActive) 
  // O usuário ainda não comprou este item

Now the question: Can you do it on iOS? A friend who has an app published in the Apple Store says there is no way without first requiring the user to log into the store.

How do I check if the user has already paid for an item?

Unfortunately some (few) users are buying the product and then ordering the upgrade for Apple. So they get the product for free.


Answer :

try this:

- (void) verificaItensComprados {
   [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
}//chame essa funçao

//no delegate da funcao
- (void) paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {
  itensCompradosIDs = [[NSMutableArray alloc] init];

  NSLog(@"numero de produtos a ser restabelecido: %i", queue.transactions.count);
  for (SKPaymentTransaction *transaction in queue.transactions)
      NSString *produtoID = transaction.payment.productIdentifier;
      [itensCompradosIDs addObject:produtoID];


Leave a Reply

Your email address will not be published. Required fields are marked *