Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70752

Ionic Native - InAppPurchase2 - When calling store.when().approved() it runs the callback before the confirmation is complete

$
0
0

@snstarosciak wrote:

I’m setting up in app purchases in my Ionic app and I’ve been having some trouble getting the test purchases working correctly. It would seem that as soon as I execute this particular function, it automatically runs the code as if it was approved, even though the confirmation to get the subscription hasn’t occurred yet:

this.platform.ready().then(() => {

      // Register the products for consumption
      this.products.forEach(product => {
        this.store.register({
          id: product.id,
          alias: product.alias,
          type: product.type
        });

        // When a purchase is approved, see what we get here
        this.store.when(product.id).approved((order) => {
          // Purchase was successful, setup the appropriate subscription
          this._subscriptions.updateSubscription(this.user.id, this.selectedPlan.amount, 'activate').then(() => {
            if(this.selectedPlan.amount === 1) {
              this.subscriptionGrammar = 'month';
            } else if(this.selectedPlan.amount > 1) {
              this.subscriptionGrammar = 'months';
            }

            order.finish();
          });
        });
      });
    });

I was under the impression that utilizing the .when().approved() would only fire once the payment “goes through”. Since I’m using test transactions, I’m not sure how that would affect it, but I would suspect it should only do that once I hit “Confirm” on the Google dialog that pops up in my app?

Is there something I’m missing here?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70752

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>