react-native-iap icon indicating copy to clipboard operation
react-native-iap copied to clipboard

Getting blank array while calling getSubscriptions to get subscription list from app store.

Open praveen-eci opened this issue 1 year ago • 7 comments

Please use the Discussion board if you want to get some help. Please use issues to report bugs.

Description I am not getting Product list from getSubscription method before the licencing update it was working fine after the update i am not able to get the subscription from the below method.

const products = await getSubscriptions({skus: itemSkus});

I have tried upgrading/degrading the library still not get any luck

Expected Behavior while calling the getSubscriptions it will return my created Subscription on app store. but getting blank array. all my subscription are active in app store.

Environment:

  • "react": "17.0.2",
  • "react-native": "0.68.2",
  • react-native-iap: "^12.10.5",
  • react-native:
  • Platforms (iOS, Android, emulator, simulator, device): iOS device

praveen-eci avatar Jul 13 '23 06:07 praveen-eci

I'm having the same issue on android, any solutions..?

coofzilla avatar Jul 19 '23 01:07 coofzilla

Any solutions? Guys. My app is on closed testing and i still get empty array for fetching subscription on real device.

dorjsurend avatar Jul 21 '23 04:07 dorjsurend

Hi @dorjsurend @coofzilla its due to policy and agreement acceptance. please check your app/play store is there any thing is left to accept. in my case i am facing this issue due to agreement acceptance for iOS. and for android i didn't get any issue.

praveen-eci avatar Jul 21 '23 05:07 praveen-eci

Hi @dorjsurend @coofzilla its due to policy and agreement acceptance. please check your app/play store is there any thing is left to accept. in my case i am facing this issue due to agreement acceptance for iOS. and for android i didn't get any issue.

In my case it was because I didn't have my offerToken on the android side. 🤦🏽‍♂️

coofzilla avatar Jul 21 '23 05:07 coofzilla

Hi @coofzilla use this below code

   const handleBuySubscription = async (productId, offerToken) => {
      try {
        await requestSubscription({
          sku: productId,
          ...(offerToken && {
            subscriptionOffers: [{sku: productId, offerToken}],
          }),
        }).then(async res => {
        // Here you will get the products.
            console.log('object', res);
          })
          .catch(e => {
            console.log('e ', e);
          });
    };

you can get the token from below subscription key:

subscription.subscriptionOfferDetails[0].offerToken,

praveen-eci avatar Jul 21 '23 08:07 praveen-eci

@praveen-eci thanks, Is it possible to fetch subscriptions in debug mode?. I think only testing needs release build.

dorjsurend avatar Jul 22 '23 04:07 dorjsurend

This is not an issue. You need to add a bank account and fill tax forms (or all requirements) to activate In-App purchases in Apple Dev Console. Otherwise, you will get an empty array.

khrulev avatar Sep 11 '23 14:09 khrulev