Posts

Post not yet marked as solved
0 Replies
198 Views
When I make a purchase with the Simulated StoreKit Failures, it indicates that the purchase was successful. When I click OK on the alert, only then does the storekit error appear in the console. It seems like it is waiting to verify the transaction until I click 'Okay' in the alert. Why doesn't he do the transaction verification immediately and wait to show the success alert? See video I take these steps: I make the purchase in the app. This is successful according to StoreKit and you will receive an alert that the purchase was successful. I press 'Okay' in the success alert. When I press "Okay" in the alert I see that the transaction failed because it could not be verified. So it seems that he only carries out the verification of the transaction as soon as I click away the success alert. ^Failed transaction message func purchase(_ product: Product) async throws -> Transaction? { print("Transactie gestart.") let result = try await product.purchase() switch result { case .success(let verification): print("Transactie doorgezet naar verificatie.") let transaction = try checkVerified(verification) //The transaction is verified. Deliver content to the user. await updateCustomerProductStatus() //Always finish a transaction. await transaction.finish() return transaction case .userCancelled: print("Transactie geannuleerd door de gebruiker.") throw StoreError.failedVerification case .pending: print("Transactie in afwachting van actie door de eindgebruiker.") return nil default: print("Er heeft zich een onbekende fout voorgedaan.") throw StoreError.failedVerification } } func checkVerified<T>(_ result: VerificationResult<T>) throws -> T { //Check whether the JWS passes StoreKit verification. switch result { case .unverified: print("Transactie mislukt doordat hij niet geverifieerd kon worden.") throw StoreError.failedVerification case .verified(let safe): let _ = print("Transactie is geverifieerd.") return safe } }
Posted
by Wouter_D.
Last updated
.