iOS presentCodeRedemptionSheetIOS

Present the App Store promo code redemption sheet.

In Xcode 27+ builds on iOS 27, Mac Catalyst 27, and visionOS 27 or later, this calls AppStore.presentOfferCodeRedeemSheet(from:options:) and returns the verified transaction produced by redemption. On iOS 16–26 and visionOS 1–26, it uses the StoreKit 2 scene-based sheet and returns null; an older SDK uses that same path on those platforms at Apple 27. iOS 15 uses the StoreKit 1 fallback and also returns null. In Mac Catalyst apps, the scene-based API throws StoreKitError.unknown (surfaced by OpenIAP as a purchase error), while the Catalyst 15 StoreKit 1 call has no effect and returns null. Reconcile null results only from an actually presented sheet through the purchase listener or an available-purchases refresh. See the Apple StoreKit reference.

Signature

swift
func presentCodeRedemptionSheetIOS() async throws -> PurchaseIOS?

Returns#

PurchaseIOS | null — the verified redeemed transaction on Apple 27+ runtimes from Xcode 27+ builds. A null result normally means the iOS or visionOS system sheet was presented but that API path cannot return its transaction directly. Mac Catalyst 15 is the exception: StoreKit 1 has no effect there and OpenIAP returns null. Mac Catalyst 16–26 rejects the scene API with an error instead of returning null.

Example

swift
let purchase = try await OpenIapModule.shared.presentCodeRedemptionSheetIOS()
if let purchase {
    print("Verified redemption:", purchase.productId)
} else {
    // iOS/visionOS: reconcile through the listener or refresh purchases.
    // Mac Catalyst 15: StoreKit 1 has no effect, so no sheet was shown.
}