Package 

Interface PurchaseLogic


  • 
    public interface PurchaseLogic
    
                        

    Interface for handling in-app purchases and restorations directly by the application rather than by RevenueCat. These suspend methods are called by a RevenueCat Paywall in order to execute you app's custom purchase/restore code. These functions are only called when Purchases.purchasesAreCompletedBy is set to MY_APP.

    If you prefer to implement custom purchase and restore logic with completion handlers, please implement PurchaseLogicWithCallback.

    • Method Summary

      Modifier and Type Method Description
      abstract PurchaseLogicResult performPurchase(Activity activity, Package rcPackage) Performs an in-app purchase for the specified package.
      abstract PurchaseLogicResult performRestore(CustomerInfo customerInfo) Restores previously completed purchases for the given customer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • performPurchase

         abstract PurchaseLogicResult performPurchase(Activity activity, Package rcPackage)

        Performs an in-app purchase for the specified package.

        If a purchase is successful, syncPurchases will automatically be called by RevenueCat to update our database. However, if you are using Amazon's store, you must call syncAmazonPurchase in your code.

        Parameters:
        activity - The current Android Activity triggering the purchase.
        rcPackage - The package representing the in-app product that the user intends to purchase.
      • performRestore

         abstract PurchaseLogicResult performRestore(CustomerInfo customerInfo)

        Restores previously completed purchases for the given customer.

        If restoration is successful, syncPurchases will automatically be called by RevenueCat to update our database. However, if you are using Amazon's store, you must call syncAmazonPurchase in your code.

        Parameters:
        customerInfo - An object containing information about the customer.