What are Google Play Billing and IAP?
The Google Play Billing feature allows users to purchase digital content directly from your app. For example, a user can purchase additional levels in a game. Amazon In-App Purchasing (IAP) is the equivalent feature for the Amazon Appstore. If your app uses Google Play Billing, you can modify your code to use Amazon IAP. Both Google and Amazon APIs have similar functionality with some differences in naming and terminology.Amazon IAP versus Google Play Billing
This section discusses the similarities and differences between Google Play Billing and Amazon IAP from the Appstore SDK.Feature comparison
The following table shows a comparison between Appstore SDK IAP and Google Play Billing.| Feature | Appstore SDK IAP | Google Play Billing | Comments |
|---|---|---|---|
| Purchases | |||
| Intents handled by API. | Yes | No | |
| Consumables | |||
| Individual consumables may be purchased multiple times. | Yes | Yes | |
| Entitlements | |||
| Purchased once. Users notified if they try to purchase an entitlement they already own. | Yes | Yes | |
| Subscriptions | |||
| Variety of options for time period that a subscription runs. | Yes | Yes | Amazon IAP options: Weekly, Bi-weekly, Monthly, Bi-monthly, Quarterly, Semi-annually, Annually Google Play options: Monthly, Annually, Seasonal (custom) |
| Supports free trial periods. | Yes | Yes | |
| Auto-renew option. | Yes | Yes | |
| Deferred billing option. | No | Yes | |
| Receipt verification | |||
| Receipt verification service for purchases | Yes | Yes | Although Google Play does provide receipt verification, Google Play receipt verification process is not automated. |
Google Play managed objects versus Amazon consumables and entitlements
Google Play Billing and Amazon IAP both let your customers make the same types of in-app purchases. However, Google Play and Amazon use different terminology for their purchase types. The following table notes the Google Play equivalent for each Amazon purchase type.Migrate to the Appstore SDK
To migrate from Google Play Billing to the Appstore SDK, follow these instructions.- Download and configure the Appstore SDK.
- Configure your AndroidManifest.xml file to support Appstore SDK IAP.
- In your app, implement logic to mediate between Google Play Billing and IAP.
- Add and implement the Appstore SDK IAP API.
- Test your app.
Step 1. Download and configure Appstore SDK
Download the Appstore SDK here: To configure the Appstore SDK for your app, follow the instructions in Integrate the Appstore SDK.Step 2. Configure your AndroidManifest.xml file
Configure your AndroidManifest.xml file to define the IAPResponseReceiver for your app. The IAP ResponseReceiver ensures that the intent communication from the Amazon Client is intercepted by your app. If you are supporting both Google Play Billing and Amazon IAP, you don’t need to remove elements related to Google Play Billing; they will simply be ignored by IAP.
In your AndroidManifest.xml file, add the appropriate <receiver> tag for the IAP ResponseReceiver. If your app targets Android 12 or higher, you must explicitly set android:exported to true in the MainActivity and ResponseReceiver as shown in the following example.
Step 3. Implement logic to mediate between Google Play Billing and IAP
You can use the same code base for your app, regardless of where your app is hosted. Just add logic to your app to determine whether the app was downloaded from the Amazon Appstore or from Google Play. Depending on where the user downloaded the app, run the appropriate methods for either IAP or Google Play Billing. The following example code determines whether a package was installed from Google Play or the Amazon Appstore:Step 4. Add and implement the Appstore SDK IAP API
For the most part, Appstore SDK IAP works similarly to Google Play Billing. When you create the path in your code to implement the IAP API, you should be able to use a similar logic flow to Google Play, but will need to account for different class and method names. The following table maps the most frequently used IAP methods to their Google Play equivalents:| PurchasingService method | PurchasingListener callback | Response object | Google Play Equivalent |
getUserData() | onUserDataResponse() | UserDataResponse | N/A |
getPurchaseUpdates() | onPurchaseUpdatesResponse() | PurchaseUpdatesResponse | queryPurchases() |
getProductData() | onProductDataResponse() | ProductDataResponse | getSkuDetails() |
purchase() | onPurchaseResponse() | PurchaseResponse | launchBillingFlow() |
notifyFulfillment() | N/A | N/A | consumeAsync() |

