StoreKit2 is being tested in a Sandbox environment for the purchase of consumable items. The code being implemented is below.
let result = try? await product.purchase()
switch result {
case let .success(verification):
switch verification {
case let .verified(transaction):
let jws = verification.jwsRepresentation
let success = await purchaseItem(of: itemId, with: jws)
if success {
await transaction.finish()
return (success: true, error: nil)
} else {
return (success: false, error: .serverError)
}
case .unverified:
return (success: false, error: .unverified)
}
Assume that the verification was successful, but a server error occurred. in let success = await purchaseItem(of: itemId, with: jws),
success = false
When tested in Sandbox and local environment, the first alert of purchase completion is displayed. After that, a purchase failure alert is displayed. (The purchase failure alert is displayed by the result of return (success: false, error: .serverError)
)
-
Is it proper behavior to display purchase completion once?
-
Is it appropriate behavior for the purchase completion to be displayed once in the production environment?
-
Is the billing actually occurring at this time?
Thank you in advance for your answers!