Skip to main content

So I'm using the @ionic-native/purchases plugin for setting up in-app subscriptions. The only plugin-related code I have is

    this.purchases.setDebugLogsEnabled(true);
    this.purchases.setup(environment.purchasesAPIKey, appUserID);

on the app's initializing.

And then in another component:

    this.purchases.getPurchaserInfo().then((purchaserInfo) => {
      console.log('purchaserInfo:', JSON.stringify(purchaserInfo));
    });
    this.purchases.getOfferings().then((offerings) => {
      console.log('offerings:', JSON.stringify(offerings));
    });
    this.purchases.getProducts(r'product1_test']).then((products) => {
      console.log('products:', JSON.stringify(products));
    });
    console.log('appUserID:', this.purchases.getAppUserID());

 

All the methods return empty lists / objects, e.g.:

offerings: {"all":{},"current":null}

 

Even though the underlying request that I found in Android Studio's Profiler gives back proper offerings data:

{
  "current_offering_id": "default",
  "offerings": d
    {
      "description": "Standard Set of Packages",
      "identifier": "default",
      "packages": e
        {
          "identifier": "$rc_monthly",
          "platform_product_identifier": "product1_test"
        }
      ]
    }
  ]
}

If the products or offerings are null, it’s usually due to some configuration issue in Apple / Google. We’ve outlined the reasons for this in our Empty Products article here: 

 


Reply