Reputation: 3395
I am in the process of testing my in App purchase in the sandbox environment. When I start the process of "restoreCompletedTransactions" I get the dialogue that asks me to enter the password of the test user. If at that stage I simply press cancel I dont get any feedback that the process has been cancelled.
Any suggestions
Reza
Upvotes: 1
Views: 2845
Reputation: 134
When the user press the cancel button This Methods are called so place place proper message.
- (void)failedTransaction:(SKPaymentTransaction *)transaction {
[[SKPaymentQueue defaultQueue] finishTransaction: transaction];
}
if (transaction.error.code != SKErrorPaymentCancelled)
{
NSLog(@"Transaction error: %@", transaction.error.localizedDescription);
}
- (void)paymentQueue:(SKPaymentQueue *)queuerestoreCompletedTransactionsFailedWithError:(NSError *)error {
NSLog(@"%s","User Cancel.");
}
Upvotes: 0
Reputation: 12085
If the user clicks the cancel button then request will fail - use a store observer like so...
[[SKPaymentQueue defaultQueue] addTransactionObserver:observer];
And handle like this....
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
for (SKPaymentTransaction *transaction in transactions)
{
switch (transaction.transactionState)
{
case SKPaymentTransactionStatePurchased:
[self completeTransaction:transaction];
break;
case SKPaymentTransactionStateFailed:
[self failedTransaction:transaction];
break;
case SKPaymentTransactionStateRestored:
[self restoreTransaction:transaction];
default:
break;
}
}
}
Upvotes: 0
Reputation: 170849
In case you cancel restoring purchases paymentQueue:restoreCompletedTransactionsFailedWithError:
method should get called in your payment transactions observer.
Upvotes: 7