Reputation: 2167
Is it possible to cancel SKPaymentTransaction
in SKPaymentTransactionStatePurchasing
from code?
I'd like to interrupt a purchase happening on iOS from an observer to try to sell another product instead.
Is there a way to remove the transaction from the queue to stop it from happening? This throws an exception:
- (void) paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
for (SKPaymentTransaction *transaction in transactions)
{
switch (transaction.transactionState)
{
...
case SKPaymentTransactionStatePurchasing: {
// this throws
[queue finishTransaction: transaction];
break;
}
...
}
}
}
Upvotes: 0
Views: 890
Reputation: 17229
The answer is no, you cannot. If you want to do this, intercept the action before you submit the SKPayment request.
The SKPaymentTransactionStatePurchasing
status is purely informational.
Upvotes: 0
Reputation: 6969
What you are trying to do is obviously going against SKPaymentTransactionObserver protocol implementation, and definitely something that Apple would not want.
You are finishing a transaction midway during status reporting. You seem to do it like aborting a file transfer when it is 51% done, but come on, there is real purchase going on, with user expecting some product (different than the one you are trying to sell him next)!
Upvotes: 3