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!

PurchaseOption is for sending parameters to the App Store for a purchase. Those values are not necessarily returned in the Transaction for the purchase. That said, one option you may find useful is .appAccountToken(_:). StoreKit 2 provides a way to add a UUID value to a purchase, to correlate an account in your system to the purchase. This value will persist in the appAccountToken property of the Transaction.

How to handle Product.PurchaseOption in StoreKit 2?
 
 
Q