SlideME In-App-Payments (IAP) SDK

SlideME In-App-Payments (IAP) SDK is developed from the ground up, with ease of integration in mind. It provides a simple and secure way to interface with our billing system using asynchronous network calls.

Note: SlideME also supports OpenIAB, an open OnePF standard, single IAP SDK for multiple stores, such as Google Play, Amazon, SlideME and for other stores that plan to support this open standard.

The SlideME IAP SDK is designed to support two types of products:

  1. "In-App"
  2. "Subscription"  (pending)

An "In-App" product is a product that can be consumed and be re-purchased unlimited times. That means that only one(1) non-consumed in-app product (of a specific item-sku) can be purchased (owned) at any time. If a product is not consumed, it's considered an "active" product and therefore the system will deny any further purchases. A subscription is an auto renewing according to the renewal period that is set up in the administration.

Note: The Subscription in-app product type implementation has not been finalized. This is a server side implementation and won't need an SDK update. Feel free to proceed with the "In-App" type and watch this space for updates for the "Subscription" type.

Generate validation key

  1. Log in to your developer account
  2. Go to Applications tab (, visit "Keypair list"  to "Add new key". Provide a meaningful Key Name e.g. 'myApplicationName IapKey' so you can recognize it later on.
  3. Once the key is generated you can copy the public key signature and paste it in your applications verify methods (check sample application).

Plan your IAP products

Each IAP product must have a "Product ID", product ids must be unique for each application you upload.

Product id's can be alphanumeric, there are no restrictions in the combination of characters with a max length of 50 characters.

You will use your product id's when building your app and after uploading your app in SlideME.

InApp SDK integration

The entire SDK functionality is wrapped in the InAppHelperActivity's life-cycle & callback methods. 

Extend InAppHelperActivity in your own activity that should display the in app purchasing options and override some or all of its callback methods.

  1. Add InApp SDK library jar to your project
  2. Add the following permission to your AndroidManifest.xml 
    <uses-permission android:name="com.slideme.sam.manager.inapp.permission.BILLING" />
  3. extend InAppHelperActivity, e.g.
    public class MainActivity extends InAppHelperActivity

You should start using the SDK once it's set-up and ready. You can check if the SDK is ready with the isReady() function. Once the SDK is ready for use the onIapReady() callback method is fired. From there on, you can safely use any couple of the request-callback helper methods of InAppHelperActivity.

Load user purchases

Call loadPurchases(String type) with one of:

  • Constants.InAppProductType.ALL;
  • Constants.InAppProductType.PRODUCT;
  • Constants.InAppProductType.SUBSCRIPTION;

A good time to call this would be right after the inApp SDK is set-up:

protected void onIapReady() {

Load IAP items details

Call loadList(List<String> ids) with a list of the SKU ids that you wish to retrieve details (e.g. price) for. Once the response is ready, callback method onListLoaded(result) is loaded and the result object containing the List<Product> is in your disposal.

The id's are defined by you and can be anything you want, as long as they are unique. You will be asked to create the same IAP id's once you upload your application to SlideME (see "Create IAP Products").

Purchase an item

Call purchase(String sku, String developerPayload) in order to start the purchase flow for the specific sku.

A good time to call this would be in a buy button's onClickListener().

Once purchasing is finished, callback method onPurchaseFinished(purchaseResult) is called and the result object is in your disposal. Check purchaseResult.status and purchaseResult.purchaseResult. It is advised to validate the purchaseResult signed data using your generated public key.

Consume an item

Call consume(String sku) in order to consume an iap item. Once the consume request has finished the callback method onPurchaseConsumed(int result) the result can be one of:

  • InAppStatus.SUCCESS
  • InAppStatus.CANCELLED  
  • InAppStatus.INVALID_IAP_ID
  • InAappStatus.ERROR

InApp SDK Integration (alternative)

Another way to integrate with SlideME IAP SDK is using the InAppHelper Interface/InAppHelperCallback.

  1. Implement the interface in you activity:
    public class MainActivity extends Activity implements InAppHelperCallback
  2. Bind InAppHelper  with some of the activity lifecycle methods
    private InAppHelper inAppHelper;
    public void onCreate(Bundle savedInstanceState) {
        inAppHelper = new InAppHelper().create(this, this);
    protected void onDestroy() {
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        switch (requestCode) {
        case InAppHelper.REQUEST_CODE_BUY:
            Bundle b;
            if(data == null || data.getExtras() == null) {
                b = new Bundle();
                b.putInt(Constants.BUNDLE_STATUS, InAppStatus.ERROR);
            } else {
                b = data.getBundleExtra(Constants.EXTRA_RESPONSE);
            onPurchaseFinished(new PurchaseResult(b));

Create IAP Products

Once your application is uploaded you can create your IAP Products.

  1. Go to Applications tab ( and select your Application
  2. Go to Manage IAP tab
  3. Add new IAP Product(s). Create a new IAP entry for each IAP product you wish to add. The important part of this step is to be sure that "Product ID" field is the exactly the same as the one you are using in your application for this specific product.

Test Mode

During development you can use test mode to check your application behavior under different scenarios. You can emulate success or failure, by changing the "Test mode" option value accordingly.

Note: When in Test Mode, purchases aren't recorded and therefore not returned in onPurchasesLoaded. This however will work as expected when your app is Published and Test Mode is disabled.

Caution: When you are ready to Publish your app you should disable 'Test Mode'.


As mentioned in OpenIAB wiki, for testing OpenIAB integration, your apk must be installed on the device using adb with the SlideME package name as the installer, like so:

adb install -i com.slideme.sam.manager /path/to/YourApp.apk

This is required by OpenIAB in order to distinguish which store should handle the IAP purchase flow. The manual adb installation is only needed during testing. When you release your app to the SlideME market this will be automatically handled from the SlideME Market (SAM) application.

Check list

  1. Plan your IAP product items
  2. Implement your IAP product items within your app
  3. Create key-pair for your app.  "My Applications" > "Add new key"
  4. Submit/upload your App to SlideME and assign Key pair to this app and keep App "Unpublished". From this Edit app form, go to "IAP key:" to associate your app to a key-pair
  5. Create your IAP products. View your app details, select "Manage IAP" menu
  6. Enable Test Mode to test while keeping app "Unpublished". Visit IAP item from Manage IAP menu > Select IAP product, edit to set Test Mode.
  7. Publish your app for distribution when ready. Visit to edit your app > select checkbox at top and set to "Published". Disable Test mode if enabled.


You will need to have the new SlideME (SAM) app (version 6) that can be installed from this link to your device:   

Changes: 18 March, 2014 -   (SAM v6 production version has been released and is available from the above link that supports IAP. We are propagating release updates to all our OEM's also.)

Download the SlideME IAP SDK from the below link. 

Download the sample app project

This sample "Trivial Drive" project is a reference implementation that shows you how to integrate the SlideME IAP SDK within your application or game. Depending on your integration style you can consult either TrivialDrive_InAppHelper or TrivialDrive_InAppHelperActivity, to send in-app purchase requests, consume products, and verify data integrity.


v1.5 (20 June 2014) - Reverted Product id visibility back to public.
v1.5.1 (24 June 2014) - Added signature check example where retrieving purchases list.
v1.5.2 (26 June 2014) - Properly call onIapError() callback method when device is offline.
v1.6 (22 September 2015) - Lollipop compatibility fixes
SlideME_IAP_example_TrivialDrive_InAppHelperActivity_v1.5.2_26June2014.zip559.77 KB
SlideME_IAP_example_TrivialDrive_InAppHelper_v1.5.2_26June2014.zip560.18 KB
slideme_inappsdk_v1.6_22Sept2015.jar46.29 KB