StoreFrontDelegate

@objc public protocol StoreFrontDelegate: class

Delegate for handling purchases and purchase errors.

  • Purchase success handler delegate. This will be invoked if a user has completed a real money purchase flow or if the player can afford the product with in game currency.

    Declaration

    Swift

    func onPurchaseSuccess(productID: String, product: ProductData, isRestoring: Bool)

    Parameters

    productID

    The product identifier.

    product

    The product data object

    isRestoring

    TRUE if the product was awarded by a restore transactions call

  • Purchase failed handler delegate. Will be invoked if a purchase failed or canceled during the store flow.

    Declaration

    Swift

    func onPurchaseFailed(productID: String, product: ProductData, reason: FailReason, isRestoring: Bool)

    Parameters

    productID

    The product identifier.

    product

    The product data object

    reason

    Fail reason enum

    isRestoring

    TRUE if the product was awarded by a restore transactions call

  • Invalid product handler delegate. Will be invoked if a real money product does not exist in the catalogue or if the attempted product to purchase does not exist in the list.

    Declaration

    Swift

    func onInvalidProduct(productID: String, isRestoring: Bool)

    Parameters

    productID

    The product identifier.

    isRestoring

    TRUE if the product was awarded by a restore transactions call

  • Not enough currency handler delegate. Event is invoked when an attempt at purchasing a valid game currency product can not be afforded because the user does not have enough game currency to purchase it.

    Declaration

    Swift

    func onNotEnoughCurrency(productID: String, product: ProductData, necCosts: [CostItem])

    Parameters

    productID

    The product identifier.

    product

    The product data object

    necCosts

    List of costs that could not be afforded. Ones that can be afforded will not be included.

  • Restore all previous purchases handler delegate. Event is invoked once the restore purchases flow is complete.

    Declaration

    Swift

    func onRestorePurchasesComplete(succeeded: Bool)

    Parameters

    succeeded

    A boolean for whether or not the restore process completed successfully.