0

所以我使用@ionic-native/purchases 插件来设置应用内订阅。我拥有的唯一与插件相关的代码是

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

在应用程序的初始化。

然后在另一个组件中:

    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());

所有方法都返回空列表/对象,例如:

产品:{“全部”:{},“当前”:null}

即使我在 Android Studio 的 Profiler 中找到的底层请求会返回正确的产品数据:

{ "current_offering_id": "default", "offerings": [ { "description": "标准包集", "identifier": "default", "packages": [ { "identifier": "$rc_monthly", " platform_product_identifier": "product1_test" } ] } ] }

4

0 回答 0