Anatoliy Popov
Anatoliy Popov

Reputation: 86

Transaction not completed using SKPayment

I have not finished transaction in my app, so when i try to buy in-App with this ID i got this message:

this in app purchase has already been bought it will be restored for free

But when i press ok button, delegate methods never called.

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions{
}

- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {
}

How can i catch some event to finish this transaction?

Upvotes: 2

Views: 317

Answers (1)

Ben Flynn
Ben Flynn

Reputation: 18932

When a user tries to buy something, why not first check to see if that purchase is already in the queue?

BOOL alreadyInProgress = NO;
for (SKPaymentTransaction *tx in [[SKPaymentQueue defaultQueue] transactions])
{
    alreadyInProgress |= [tx.transactionIdentifier isEqualToString:productId];
}
if (alreadyInProgress)
{
    // Alert that the purchase is already active
}
else
{
    // Your purchase flow
}

Upvotes: 2

Related Questions