In App Purchase2 - IONIC


#1

Hello, i have problem with In app purchase2:
in the sandbox mode everything works fine, live release don’t work.

The plugin always return valid, but has a lot of purchases approved:

The plugin is: https://github.com/j3k0/cordova-plugin-purchase

My code:

this.store.register({
      id: this.productId,
      alias: this.productId,
      type: this.store.PAID_SUBSCRIPTION
    });

this.store.refresh();

//when store is ready 
let productDetails = this.store.get(this.productId);

      if(productDetails.state === "approved") {
        // Purchase was approved
        productDetails.finish();
     }
global packages:

    @ionic/cli-utils : 1.5.0
    Cordova CLI      : 7.0.1 
    Ionic CLI        : 3.5.0

local packages:

    @ionic/app-scripts              : 2.0.2
    @ionic/cli-plugin-cordova       : 1.4.1
    @ionic/cli-plugin-ionic-angular : 1.3.2
    Cordova Platforms               : android 6.2.3 ios 4.4.0
    Ionic Framework                 : ionic-angular 3.5.3

System:

    Node       : v8.1.3
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.3 Build version 8E3004b 
    ios-deploy : 1.9.1 
    ios-sim    : 5.0.13 
    npm        : 5.1.0 

Thank you


#4

Where does this come from and what is it exactly?

Is there a deeper reason why you are not using https://ionicframework.com/docs/native/in-app-purchase/?


#5

this.store come from: http://ionicframework.com/docs/native/in-app-purchase-2/

Why i’m not use https://ionicframework.com/docs/native/in-app-purchase/:
Is no longer being maintained and has problems with subscribe to IOS 10.2.3, when use restore, on purchase on live release do not return nothing


#6

Ah, so this is an Ionic Native question (I fixed the topic category for you).

Now with this link we also have the correct documentation to look at.

Did you find any sample projects using this Ionic Native plugin? Docs are a bit sparse.

But I just saw that on Github are already newer, better docs:


Maybe these help.

You should probably use the .ready() method here if you wnat to be sure.


#7

No, I did not find any project with this Native plugin.
I don’t know what happen, because on sandbox everything works fine.
I changed the code for use .ready() but nothing.

On use .ready() never return the response.


#8

Did you find a solution to this?


#9

Yes, i find a solution, thank you!


#10

What was your solution? My store.ready is never getting fired so my handlers for the rest of the store just loop forever.


#11

Hi, i think you can read this post for get some ideias!


#12

Hi there! Thanks for the link. That was the exact example I was using while running into the issue. I ended up bypassing the plugin all together and talking to the store straight with cordova instead. That fixed my issue of the ready never being called by the plugin.


#13

Can you share how you bypassed the ionic-native and used cordova directly?