Post

Replies

Boosts

Views

Activity

How to handle Product.PurchaseOption in StoreKit 2?
Trying add a set of Product.PurchaseOption when calling purchase function in StoreKit 2 on iOS 15. My expectation was for a successful transaction coming back from StoreKit would still include these purchase options allowing me to capture the options on delayed transactions (e.g. parental approval). In my particular scenario, I'd like to pass a custom string parameter to the purchase function for a non-renewable subscription: let product: Product = ... // non-renewable subscription // setup purchase options var purchaseOptions = Set<Product.PurchaseOption>() let myCustomStringOption = Product.PurchaseOption.custom(key: "myCustomString", value: "ABC4711") purchaseOptions.insert(myCustomStringOption) // call product purchase w/ options let result = try await product.purchase(options: purchaseOptions) // evaluate result switch result { case .success(let verificationResult): // purchaseOptions not available as part of the purchase result // let purchaseOptions = verificationResult...? await transaction.finish() case .userCancelled, .pending: break default: break } However, the purchaseOption "never makes it to the other side" of the purchase process. Any suggestions on how to obtain the purchase options after a successful and verified purchase? Thanks!
1
0
1.6k
Sep ’21