Instance Method

purchase(package:promotionalOffer:completion:)

Purchase the passed Package. 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.

Declaration

@objc(purchasePackage:withPromotionalOffer:completion:) func purchase(package: Package, promotionalOffer: PromotionalOffer, completion: @escaping PurchaseCompletedBlock)

Parameters

package

The Package the user intends to purchase

promotionalOffer

The PromotionalOffer to apply to the purchase

completion

A completion block that is called when the purchase completes.

Discussion

If the purchase was successful there will be a StoreTransaction and a CustomerInfo. If the purchase was not successful, there will be an Error. If the user cancelled, userCancelled will be true.

See Also

Making Purchases with Subscription Offers