InAppPurchase2 seems useless without docs. Having issue with simple initialization

Hey everyone,

I’m trying to integrate the InAppPurchase2 plugin in my Ionic app and am having an awful time trying to do so. The docs are super incomplete and pretty much not useful at all and from the tidbits I’ve found on the forums, I still can’t get anything to work.

All I’m trying to do right now is see if the plugin will load in one of my components like this:

constructor(
    public navCtrl: NavController,
    public storage: Storage,
    public http: Http,
    public inAppPurchase2: InAppPurchase2,
    public platform: Platform,
    public viewCtrl: ViewController
  ) {
    platform.ready().then(() => {
      if(platform.is('ios')) {
        this.storeName = 'iTunes';
      } else if(platform.is('android')) {
        this.storeName = "Google Play";
      }
      
      this.inAppPurchase2.ready(() => {
        this.product = JSON.stringify('it worked');
      
      })
    });
  }

However, when I try to build my Android app, I get an error in my console:

[11:28:56]  typescript: src/pages/payment-subscription/payment-subscription.ts, line: 38
            Supplied parameters do not match any signature of call target.

      L38:   this.inAppPurchase2.ready(() => {
      L39:     this.product = JSON.stringify('it worked');

[11:28:56]  transpile failed

What am I doing wrong here? Should I just use InAppPurchase since the docs are more complete? You’d think this would be a common feature that people are adding to their Ionic apps.

ready().then(() => JSON etc)

I understand that it’s frustrating trying to understand these plugins without documentation (I’m struggling to use the exact same plugin right now), but it’s important to understand that open source projects are done by volunteers and it seems like maybe you’ve forgotten that fact and are misdirecting your anger.

Regardless, there are multiple sources where you can read more about the plugin including this medium post: https://medium.com/@andrew.thielcole/in-app-purchases-with-ionic-3-af13b21f49f2
and also the github repo for the cordova plugin itself (not the ionic-native wrapper).

You make a good point. I think looking into the actual source code will be my best bet for now :smiley: