React Native IAP getSubscriptions returns empty array for android

Viewed 39

Can You help me, please? In google play console when I set Auto-renewing subscription for my app, then all are work correct. But when I set prepaid, it doesn't work, I get IAP.getSubscriptions empty array. What can it be connected with? How can I solve this issue? This is the part of my code:

componentDidMount() {
      IAP.initConnection().catch(() => {
          console.log("error connecting to the store")
      }).then(setConnected => {
          console.log("setConnected", setConnected)
      })
          .then(() => {

              const productIds = Platform.select({
                  ios: [
                      'lightme_ios_30d'
                  ],
                  android: [
                      'lightme_android_30day'
                  ]
              });
              try {
                  IAP.getSubscriptions(productIds).catch((err) => {
                      console.log("error--", err)
                  }).then((res) => {
                      console.log("Subscriptions was loaded", res);
                      this.setState({
                          products: res
                      });
                  })
              } catch (err) {
                  console.warn(err);
              }
          }).catch((error) => {
              console.log("error connecting", error)
          })

  }   
0 Answers
Related