-
Notifications
You must be signed in to change notification settings - Fork 12
Amazon
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.0@aar'
compile 'com.amazon:in-app-purchasing:2.0.61'
}
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>
final AmazonBillingProvider amazon = new AmazonBillingProvider.Builder(context)
// optional
.setPurchaseVerifier(new MyAmazonPurchaseVerifier())
// optional
.setSkuResolver(new MyAmazonSkuResolver())
.build();
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.
-optimizationpasses 1
-dontwarn com.amazon.**
-keep class com.amazon.** {*;}
-keepattributes *Annotation*
Check here for more details.
There are two ways to test Amazon in-app billing with you app.
- Using Amazon App Tester-optimizationpasses 1
- App Tester User Guide
- Download and install Amazon App Tester
- Add [JSON file](https://developer.amazon.com/public/apis/earn/in-app-purchasing/docs-v2/installing-and-configuring-app-tester#Obtaining a JSON Data File) to your testing device.
- Live App Testing
It's recommended to that you try both before releasing your app.
- 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.