A
A
Alexey2016-11-07 12:05:45
Angular
Alexey, 2016-11-07 12:05:45

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" />

4) On the template page:
<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>

5) In the controller file:
$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);
      });
    };

6) I create a build: I cordova build --release androidsign, archive and install it in a real phone.
7) Google Play has the same version of android - a beta version in the Published status. 2 products in Active status.
Question:
What did I forget? Didn't write? When you click on the get all products button, the result is an empty array worked on the success promise. I would appreciate any comments!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question