Answer the question
In order to leave comments, you need to log in
Ionic and Google Play purchases?
A situation has arisen that I can not solve for more than 4 days ...
Implementation of the possibility of in-app purchases on Google Play.
The application is written in Ionic, Angular first version. For purchases, I use the Alex Disler library https://github.com/AlexDisler/cordova-plugin-inapp...
Timeline of what I did:
1) Installed cordova plugin add cc.fovea.cordova.purchase --variable BILLING_KEY="My key"
2) Added to manifest.json:
{ "play_store_key": "MyRSA key" }
3) Added billing permission to AndroidManifest:
<uses-permission android:name="android.permission.BILLING" />
<uses-permission android:name="com.android.vending.BILLING" />
<button ng-show="!products" ng-click="loadProducts()" class="button button-block button-balanced">
<i class="ion-arrow-down-c"></i> Load Products
</button>
<button ng-repeat="product in products" ng-click="buy(product.productId)" class="button button-block button-positive">
{ { product.title }} - { { product.price }}
</button>
<h3>Restore Purchases</h3>
<button ng-click="restore()" class="button button-block button-balanced">
<i class="ion-refresh"></i> Restore
</button>
$scope.loadProducts = function () {
$ionicLoading.show({ template: spinner + 'Loading Products...' });
alert('If Isset inAppPurchase: ' + inAppPurchase);
inAppPurchase
.getProducts(productIds)
.then(function (products) {
$ionicLoading.hide();
alert('If Isset products: ' + products);
$scope.products = products;
})
.catch(function (err) {
$ionicLoading.hide();
alert('Error: ' + err);
alert(err);
});
};
cordova build --release android
sign, archive and install it in a real phone. Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question