We are using method “Transaction.latest(for: productId)” to verify the transaction .
Steps to reproduce :
Step 1 : User made purchase for productId “product_id_one”
Step 2 : “paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction])” api returns successful purchase for product_id_one .
func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
for transaction in transactions {
switch transaction.transactionState {
case .purchased:
let mProductId = transaction.payment.productIdentifier
Print(mProductId) // product_id_one
..
Step 3: Call “Transaction.latest(for: product_id_one)” api .
guard let verificationResult = await Transaction.latest(for: productId) else {
// Here some times its returning nil for valid transaction
return
}
switch verificationResult {
case .verified(let transaction):
// at time its working fine . we are getting verified purchase .
// Check the transaction and give the customer access to purchased
case .unverified(let transaction, let verificationError):
// Here some times its returning unverified for valid transaction
}
Issue : For valid purchase , Sometimes Transaction.latest(for: productId) api is returning nil and unverified transaction . This is intermittent issue.