Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.
Roman Zhilich edited this page Jun 5, 2015 · 23 revisions

This BillingProvider implementation adds support for Amazon Appstore.

###Dependency Amazon billing provider depends on proprietary in-app-purchasing.jar which can be found within Amazon Mobile App SDK.

You can download it yourself and manually add it to your project, or user our GitHub hosted repo instead:

allprojects {
  repositories {
    ...
    // third-party dependencies
    maven { url 'https://raw.githubusercontent.com/onepf/OPF-mvn-repo/master/' }
  }
}

Dependencies:

dependencies {
    compile 'org.onepf:opfiab-amazon:0.2.2@aar'
    compile 'com.amazon:in-app-purchasing:2.0.61'
}

Adding as jar

Add following entries to your AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<application>
    <receiver
        android:name="com.amazon.device.iap.ResponseReceiver"
        android:exported="true">
        <intent-filter>
            <action
                android:name="com.amazon.inapp.purchasing.NOTIFY"
                android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY"/>
        </intent-filter>
    </receiver>
</application>

Usage

final AmazonBillingProvider amazon = new AmazonBillingProvider.Builder(context)
                // optional
                .setPurchaseVerifier(new MyAmazonPurchaseVerifier())
                // optional
                .setSkuResolver(new MyAmazonSkuResolver())
                .build();

Purchase Verification

According to official documentation Amazon recommends using server-side purchase verification.
Unfortunately that means you'll have to make your own implementation of PurchaseVerifier interface.

Proguard

-optimizationpasses 1 

-dontwarn com.amazon.**
-keep class com.amazon.** {*;}
-keepattributes *Annotation* 

Check here for more details.

Testing

There are two ways to test Amazon in-app billing with you app.

  1. Using Amazon App Tester
  1. Live App Testing

It's recommended to that you try both before releasing your app.

FAQ

  • I'm logged in Amazon but I get Unauthorized response code from library.

App can only communicate with Amazon Store if it was downloaded from it. To test your app without uploading it to store you'll need Amazon App Tester.

Clone this wiki locally