No results found

Try a different or more specific query
Developer Console

Appstore Billing Compatibility SDK

If you have an existing Android app that is integrated with the Google Play Billing Library, you can use the Appstore Billing Compatibility SDK to port your app to the Amazon Appstore with minimal changes. The Appstore Billing Compatibility SDK supports consumable and entitlement in-app purchases (IAP). Subscriptions IAPs are not supported.

The following table shows a feature comparison between the Google Play Billing Library, the Appstore SDK, and the Appstore Billing Compatibility SDK.

Feature comparison
Feature Google Play Billing Library Appstore SDK Appstore Billing Compatibility SDK
Subscriptions See note
Digital Rights Management (DRM)

Download the Appstore Billing Compatibility SDK

To download the Appstore Billing Compatibility SDK, visit SDK Downloads. The download includes the Appstore Billing Compatibility JAR file and API documentation.

Integrate the Appstore Billing Compatibility SDK

Use this step-by-step guide to integrate the Appstore Billing Compatibility SDK with your app.

Step 1. Add the SDK to your app

Manually add the Appstore Billing Compatibility SDK to your Android app project:

  1. Expand your app folder and select libs (If you don't have a libs folder, create one). Paste the appstore-billing-compatibility-4.0.0.jar file into this directory.
  2. Open your app folder's build.gradle file and add a dependency on the appstore-billing-compatibility-4.0.0.jar. For example:
     dependencies {
         implementation files('libs/appstore-billing-compatibility-4.0.0.jar')
  3. Sync your project by selecting Sync Now at the top of your build.gradle file in your IDE.

Optionally, you can remove the Google Play Billing Library dependency from your app.

Step 2. Configure your Android app with the public key

This public key, which is unique per app, establishes a secure communication channel between the Amazon Appstore and your app. When you generate the public key from the Amazon Developer Console, Amazon generates a corresponding private key. These public and private keys form a key pair to sign license responses. Through this key pairing, you ensure that the users who install your app are authorized.

To configure your Android app with the public key:

  1. Log in to the Developer Console with your developer account.
  2. Go to Apps & Services > My Apps. If you have an existing app, click on the app. Otherwise, create a new app by clicking on the Add New App button and selecting Android, then complete the New App Submission page.
  3. Go to the Add App Bundles or APK Files section on the App Information tab.
  4. Click Public Key.
  5. In the Public Key dialog box that appears, click the AppstoreAuthenticationKey.pem link to download a PEM file. This file contains your public key.
  6. Copy the AppstoreAuthenticationKey.pem file. Then paste it into the app/src/main/assets folder of your Android app project. If you don't have this folder, create one.

Optionally, you can remove the Google Play Billing public key dependency.

Step 3. Configure your AndroidManifest.xml file with receiver

The Appstore Billing Compatibility SDK performs all of its activities in an asynchronous manner. Your app needs to receive broadcast intents from the Amazon Appstore through the BillingResponseReceiver class. This class is never used directly in your app, but for your app to receive intents, you must add an entry for the BillingResponseReceiver to your manifest.

The following example code shows how to add a BillingResponseReceiver to the AndroidManifest.xml file for the Appstore Billing Compatibility SDK. If your app targets Android 12 or higher, you must explicitly set android:exported to true in the MainActivity and ResponseReceiver.

    <activity android:name=""
              android:label="@string/app_name" android:exported="true" >
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
    <receiver android:name="" android:exported="true"
            <action android:name="" />

Step 4. Update import statements

Update Google Play Billing imports in your app's codebase to use Appstore Billing Compatibility SDK imports by finding all usages of the prefix and replacing them with the prefix.

If any Appstore Billing Compatibility SDK import statement is unresolved, that indicates it isn't supported by the Appstore Billing Compatibility SDK. Remove or modify its usage in the app to make it work with the Amazon Appstore.

Next steps

See Implement the Google Play Billing Interface.

Last updated: Mar 15, 2023