StoreAccess

public class StoreAccess: NSObject, SKProductsRequestDelegate, SKPaymentTransactionObserver

StoreAccess is responsible for requesting products from the store, providing information about products by conforming to StoreProductsDataSource, purchasing products and restoring previous purchases.

  • Provides identifier for product that was purchased or restored.

    Declaration

    Swift

    public typealias PurchaseCompletionBlock = (_ purchasedProductIdentifier: String) -> ()

    Parameters

    purchasedProductIdentifier

    Identifier for product that was purchased.

  • A closure that is executed when product purchased.

    Warning

    If this is nil, StoreAccess won’t be able to purchase product or restore purchases.

    Declaration

    Swift

    public var purchaseCompletionHandler: PurchaseCompletionBlock?
  • Current StoreAccess state.

    Declaration

    Swift

    public fileprivate(set) var state: StoreAccessState = .unknown
  • StoreAccess singleton.

    Declaration

    Swift

    public class var shared: StoreAccess
  • Starts a request for products with provided identifiers.

    • paramater identifiers: Set of identifiers for products to be requested.

    Declaration

    Swift

    public func requestProductsWithIdentifiers(_ identifiers: Set<String>)
  • Start purchasing product with provided identifier.

    • paramater identifier: Identifier for product to be purchased.

    Declaration

    Swift

    public func purchaseProductWithIdentifier(_ identifier: String)
  • Start restoring previous purchases.

    Declaration

    Swift

    public func restorePurchases()