Instance Method

purchase(product:)

Initiates a purchase of a StoreProduct.

Declaration

func purchase(product: StoreProduct) async throws -> PurchaseResultData

Parameters

product

The StoreProduct the user intends to purchase.

Discussion

Use this function if you are not using the Offerings system to purchase a StoreProduct. If you are using the Offerings system, use purchase(package:completion:) instead.

From here Purchases will handle the purchase with StoreKit and call the PurchaseCompletedBlock.

If the user cancelled, userCancelled will be true.

See Also

Making Purchases