Post

Replies

Boosts

Views

Activity

SKPaymentTransaction With Transaction State Incorrect
Hi, I'm receiving an incorrect returning state from SKPaymentTransaction. I have a subscription plan that users can purchase and have access to new features in my app, but, for some reason, even if it's a new app account or new appstore account, when it reaches the SKPaymentTransaction.TransactionState, it always says that the state is SKPaymentTransactionStatePurchased. This code haven't been changed since 2018 and this error started about 1 week ago. This is the full code: - (void)createPaymentWithProduct:(SKProduct *)product { SKMutablePayment *payment = [SKMutablePayment paymentWithProduct:product]; payment.quantity = 1; [[SKPaymentQueue defaultQueue] addTransactionObserver:self]; [[SKPaymentQueue defaultQueue] addPayment:payment]; } - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions { for (SKPaymentTransaction *transaction in transactions) { switch (transaction.transactionState) { // Call the appropriate custom method for the transaction state. case SKPaymentTransactionStatePurchasing: [self purchasingTransaction:transaction]; break; case SKPaymentTransactionStateDeferred: [self failedTransaction:transaction]; break; case SKPaymentTransactionStateFailed: [self failedTransaction:transaction]; break; case SKPaymentTransactionStatePurchased: { //It reaches this case but never reaches Purchasing [self purchasedTransaction:transaction]; break; } case SKPaymentTransactionStateRestored: [self restoredTransaction:transaction]; break; default: // For debugging NSLog(@"Unexpected transaction state %@", @(transaction.transactionState)); [self failedTransaction:transaction]; break; } } } After the queue, it calls this functions that ask for the payment receipt, which returns me an error because it's not purchased, so it doesn't have a receipt. - (void)purchasedTransaction:(SKPaymentTransaction *)transaction { [self sendReceiptToServerForTransaction:transaction]; if (self.purchasedNotification) { self.purchasedNotification(); } }
0
0
517
Nov ’23