Contents

purchase(confirmIn:options:)

Initiates a purchase for the product with the App Store and displays the confirmation sheet.

Declaration

@MainActor func purchase(confirmIn scene: some UIScene, options: Set<Product.PurchaseOption> = []) async throws -> Product.PurchaseResult

Parameters

  • scene:

    The Uiscene the system uses to show the purchase confirmation UI.

  • options:

    A set of options (Purchaseoption) you can associate with the purchase.

Return Value

The result of the purchase, Product.PurchaseResult.

Discussion

StoreKit provides several APIs you can use to enable customers to initiate a purchase. Before using purchase(confirmIn:options:), consider the following APIs and choose the one that best suits your app’s implementation:

This method may throw a Product.PurchaseError or StoreKitError.

See Also

Purchasing a product