Solved

Ionic's Purchases plugin can't get any entities

  • 2 August 2021
  • 1 reply
  • 68 views

Badge

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(['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": [
    {
      "description": "Standard Set of Packages",
      "identifier": "default",
      "packages": [
        {
          "identifier": "$rc_monthly",
          "platform_product_identifier": "product1_test"
        }
      ]
    }
  ]
}

icon

Best answer by ryan 4 August 2021, 18:20

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: 

 

View original

1 reply

Userlevel 4
Badge +8

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