Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It takes too much time to verify all of the receipts when restore purchases #9

Closed
burakkilic opened this issue Sep 26, 2013 · 2 comments
Labels

Comments

@burakkilic
Copy link

Hi;

I have 10 products purchased. When I want to restore it, code is waiting tooo much because for every product, it goes to server again to make receipt verification because of the code:

- (void)restoreTransaction:(SKPaymentTransaction *)transaction

{
SKPaymentTransaction *originalTransaction = transaction.originalTransaction;
SKPayment *payment = originalTransaction.payment;
RMStoreLog(@"transaction restored with product %@", payment.productIdentifier);

_pendingRestoredTransactionsCount++;
/*if (self.receiptVerificator != nil)
{
    [self.receiptVerificator verifyReceiptOfTransaction:transaction success:^{
        [self verifiedTransaction:transaction];
        [self notifyRestoreTransactionFinishedIfApplicableAfterTransaction:transaction];
    } failure:^(NSError *error) {
        [self failedTransaction:transaction error:error];
        [self notifyRestoreTransactionFinishedIfApplicableAfterTransaction:transaction];
    }];
}
else
{*/
    RMStoreLog(@"WARNING: no receipt verification");
    [self verifiedTransaction:transaction];
    [self notifyRestoreTransactionFinishedIfApplicableAfterTransaction:transaction];
//}

}

I commented out the verification part. But I still want to verify when user wants to buy a product. So I cannot make receiptVerificator nil.

@hpique
Copy link
Member

hpique commented Sep 26, 2013

I assume you're using RMStoreLocalReceiptVerificator.

Simply implement your own RMStoreReceiptVerificator that always validates transactions with state SKPaymentTransactionStateRestored. You can use the code of RMStoreLocalReceiptVerificator for the other transactions.

That said, I find this requirement a bit odd. If you think your users can hack new transactions, then why wouldn't they hack restored transactions as well?

It should be noted that receipt verification takes more time on sandbox because Apple wants you to always try with the production environment first.

@hpique
Copy link
Member

hpique commented Sep 26, 2013

Also, transaction notifications are sent for each restored transaction. So you can start updating your UI BEFORE all transactions are restored.

@hpique hpique closed this as completed Sep 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants