Developer Console

Amazon Appstore Easy Port Billing Aspects

If your app uses Google Play Billing and is integrated with the Play Billing Library version 5.2.1, you can use the Amazon Appstore Easy Port billing aspects in your app to port it to Fire OS. The Easy Port billing aspects target Play Billing Library v5.2.1 and replace the library's API calls with calls from Appstore Billing Compatibility v4.1.0.

Requirements

  • App must not be already integrated with Amazon In-App Purchasing (IAP) APIs. App must not use Amazon IAP through the Appstore SDK or the Appstore Billing Compatibility SDK.
  • App must be integrated with the Amazon Appstore Easy Port plugin. For integration steps, see Integrate Amazon Appstore Easy Port plugin.
  • App's target API level must be 24 or higher, or app must have Java8+ API's desugaring enabled.
  • In an activity in the main UI thread, app must instantiate the Google BillingClient object in the onCreate() method. App must have only one instance of BillingClient present at a time.
  • All business logic related to in-app billing must be in a single module, where the aspects are applied. The aspects can't be applied to multiple modules.

Use the following steps to add the Amazon Appstore Easy Port billing aspects and related resources to your project.

  1. Identify the module that directly integrates with Play Billing Library v5.2.1 and apply the Easy Port plugin to the module. For instructions, see Apply and configure Amazon Appstore Easy Port plugin.
  2. After configuring the plugin and syncing the changes, you can find a task named AspectDownloadTask in your gradle tasks under the easy Port group. Running this task downloads the required aspects and copies the assets to the appropriate folder as follows:
    • src/easyPort - folder that contains aspect classes
    • src/main/java/easyport - folder that contains Easy Port annotations
    • libs/appstore-billing-compatibility-<version>.jar - the Appstore Billing Compatibility SDK JAR file

      To find the path to the Appstore Billing Compatibility SDK JAR file, check the AspectDownloadTask logs.
      Example logs:

      
          Add the following libs to the dependencies block in build.gradle.
          [libs/appstore-billing-compatibility-4.1.0.jar]
          

    Alternative method to add the aspects

    You can manually download and add the aspects and resources by using the following steps.

    1. Download the billing aspect files here.

    2. In the module's src folder, add the easyPort folder that contains the aspect files.
    3. Download the billing annotation files here.

    4. In the module's main java folder, add the easyport folder that contains the annotations.
    5. Download the Appstore Billing Compatibility SDK, and copy the JAR library file to the module's libs folder. If obfuscating your code, follow the guidance in IAP and code obfuscation to make sure IAP functionality isn't affected by code obfuscation.
  3. Add the downloaded JAR file from the previous step to the dependencies block in your module's build file as follows.

     

    Copied to clipboard.

      easyPortImplementation(files("libs/appstore-billing-compatibility-<version>.jar"))
    

     

    Copied to clipboard.

      easyPortImplementation(files("libs/appstore-billing-compatibility-<version>.jar"))
    
    Where <version> is the version of the downloaded Appstore Billing Compatibility SDK JAR file.
  4. In the easyPort folder that contains the aspects from the step 2, create an assets folder and add the AppstoreAuthenticationKey.pem file. To obtain the PEM file, follow the steps in Configure Appstore SDK with your public key.
  5. If your app has subscriptions, follow these steps.
    1. Add your subscription items in the Developer Console and export them into a JSON file. For instructions, see Appstore Billing Compatibility Subscriptions.
    2. After you export the in-app item list, save the amazon.sdktester.json file in the assets folder under the easyPort folder.
  6. Resolve any conflicts.

Last updated: May 23, 2024