Instance Method

purchase(package:completion:)

Initiates a purchase of a Package.

Declaration

@objc(purchasePackage:withCompletion:) func purchase(package: Package, completion: @escaping PurchaseCompletedBlock)

Parameters

package

The Package the user intends to purchase

completion

A completion block that is called when the purchase completes.

Discussion

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

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