Instance Method

purchase(product:promotionalOffer:)

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

Declaration

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

Parameters

product

The StoreProduct the user intends to purchase

promotionalOffer

The PromotionalOffer to apply to the purchase

Discussion

Call this method when a user has decided to purchase a product with an applied discount. Only call this in direct response to user input.

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 with Subscription Offers