Hello,
Recently, We have some issues with in-App purchase (All consumable product).
The problem is that some transactions are not being removed from the transaction queue for some users even after the "finishTransaction:transaction" had called.
Receipts are being checked on the our server. Sadly sometimes we've been receiving receipt which has old transaction info. As you see the code below, "finishTransaction" method is being called even before the checkReceipt. But the "finishTransaction" method is not working for some users, some already processed transactions stayed in the transaction queue for an indefinite period, after that everytime he/she buys a product, then the checkReceipt method is being called for 2 times. 1 for the new transaction and 1 for the already finished transaction(we checked the receipt for the transaction and gave the appropriate item to the user already). But the transaction remain in the transaction queue for an indefinite period and removed from the queue randomly.
We know that the "finishTransaction" method should be called after the receipt check. But in our app now the "finishTransaction" method is being called intentionally before the "checkReceipt" because already processed transactions not stopping to come. Thanks to God, most of our users' receipt can be checked.
Also sometimes we are getting the receipt response which has empty in_app array when we checking the receipt with Apple servers. Some users emailed us that their credit card is charged but can't get the tickets(our iAP product) since we can't accept a receipt with empty in_app array.
Lastly, Yesterday one of our users had a weird issue. According to our access log, He got the "SKErrorPaymentCancelled" error code when he was asked to "Buy tickets?" due to the App update which we released yesterday. But the "checkReceipt" method was called after that, then a receipt sent to our server and checked it with the Apple server and it seems that user has charged. Before the "checkReceipt" method, we already got the "SKErrorPaymentCancelled" error code for that transaction.
Does new transaction start after the failed transaction during app update like "StoreKitFlow process"?
Could you please tell me about why some transactions can not be removed from the transaction queue even after "finishTransaction" method is called?
Also do you know that in which case the empty in_app array is being received with receipt (Our app is free and Users are charged for iAP)?
for (SKPaymentTransaction * transaction in transactions) {
switch (transaction.transactionState)
{
case SKPaymentTransactionStatePurchased:{
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
[self checkReceipt:transaction];
break;
}
case SKPaymentTransactionStateFailed:
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
[self failedTransaction:transaction];
break;
case SKPaymentTransactionStateDeferred:
// Remove purchase screen
[[NSNotificationCenter defaultCenter] postNotificationName:@"purchaseStatus" object:@"deferredTransaction"];
break;
default:
break;
}
};