openiab-cordova-plugin-fortumo v1.0.40
OpenIAB-Cordova-Plugin
OpenIAB plugin for Cordova-based frameworks
Cordova Integration
1) Add Android platform to your project using CLI.
$ cordova platform add android2) Add OpenIAB plugin, referencing repo.
$ cordova plugin add https://github.com/onepf/OpenIAB-Cordova-Plugin.git3) Build the app.
$ cordova build4) Run it.
$ cordova run androidIntel XDK Integration
Plugin Usage
1) Include script to your application.
<script type="text/javascript" src="cordova.js"></script>2) Simply call openiab object methods, passing callback functions.
a) Map you SKUs. This step is optional.
openiab.mapSku(function(){}, function(error){}, SKU1, openiab.STORE_NAME.GOOGLE, "sku_product");b) Set some options.
Set store search strategy.
openiab.options.storeSearchStrategy = openiab.STORE_SEARCH_STRATEGY.INSTALLER_THEN_BEST_FIT;Set available stores to restrict the set of stores to check.
openiab.options.availableStoreNames = [ openiab.STORE_NAME.GOOGLE, openiab.STORE_NAME.YANDEX ];Set preferred store names (works only for store search strategy OpenIabHelper.Options.SEARCH_STRATEGY_BEST_FIT and OpenIabHelper.Options.SEARCH_STRATEGY_INSTALLER_THEN_BEST_FIT).
openiab.options.preferredStoreNames = [ openiab.STORE_NAME.GOOGLE, openiab.STORE_NAME.YANDEX ];Set store keys.
openiab.options.storeKeys = [ [openiab.STORE_NAME.GOOGLE, 'your public key'] ];Set verifying mode (applicable only for Google Play, Appland, Aptoide, AppMall, SlideMe, Yandex.Store).
openiab.options.verifyMode = openiab.VERIFY_MODE.SKIP;c) Initialize plugin.
openiab.init(function(){}, function(error){}, [ "SKU1", "SKU2", "SKU3" ]);d) Start purchase.
openiab.purchaseProduct(function(purchase){}, function(error){}, "SKU");e) Consume consumable SKUs in order to be able to purchase it again.
openiab.consume(function(purchase){}, function(error){}, "SKU");3) Use additional methods to get information about SKUs and purchases.
a) Can be used any time after init is finished.
openiab.getPurchases(function(purchaseList){}, function(error){});b) Get details of the single SKU.
openiab.getSkuDetails(function(skuDetails){}, function(error){}, "SKU");c) Get details of the SKU list.
openiab.getSkuListDetails(function(skuDetailsList){}, function(error){}, ["SKU1", "SKU2", "SKU3"]);Also consider to check sample application for cordova or xdk.
Data Structures
purchase =
{
itemType:'',
orderId:'',
packageName:'',
sku:'',
purchaseTime:0,
purchaseState:0,
developerPayload:'',
token:'',
originalJson:'',
signature:'',
appstoreName:''
}
skuDetails =
{
itemType:'',
sku:'',
type:'',
price:'',
title:'',
description:'',
json:''
}
error =
{
code:-1,
message:''
}10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago