Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getProducts() is empty #999

Closed
DavideValdo opened this issue May 8, 2020 · 18 comments
Closed

getProducts() is empty #999

DavideValdo opened this issue May 8, 2020 · 18 comments
Labels
🤖 android Related to android 🙏 help wanted Extra attention is needed Stale

Comments

@DavideValdo
Copy link

Version of react-native-iap

4.4.2

Version of react-native

0.61.5

Platforms you faced the error (IOS or Android or both?)

Android

Expected behavior

getProducts(['modulo_training_autogeno']) returns an array with 1 product

Actual behavior

Source for the whole application:

const App: () => React$Node = () => {
  const [productsJSON, setProductsJSON] = useState()

  auth().onAuthStateChanged((user) => {      
    console.log(user)
  })

  useEffect(() => {
    const _myF = async () => {
      console.log("Ciao")
      let outcome = await RNIap.initConnection()
      console.log("Outcome: " + outcome)
      
      let products = await RNIap.getProducts(['modulo_training_autogeno'])
      console.log(JSON.stringify(products))
      setProductsJSON(JSON.stringify(products))
    }

    _myF()
  })

  return (
    <>
      <Video source={{uri:''}}
        ref={ref => AudioPlayer = ref}
        playInBackground={true}
        controls={true}
        fullscreen={true}
      />

      <Text>{productsJSON}</Text>
    </>
  );
};

Got 1 active product on Play Console. Pushed signed apk for internal test.

Screenshot 2020-05-08 at 01 11 50

getProducts(['modulo_training_autogeno']) is the empty array on Android

Tested environment (Emulator? Real Device?)

Real device

Steps to reproduce the behavior

Do everything as said in the medium blog post.

Also seen #977

@hyochan
Copy link
Member

hyochan commented May 12, 2020

I hope you followed the thread.

If things don't work as expected, I hope you try things all over again because you may have missed somethings. I've been creating products to test this module several times and I've not had failed since then.

@hyochan hyochan added 🤖 android Related to android 🙏 help wanted Extra attention is needed labels May 12, 2020
@illiteratewriter
Copy link

illiteratewriter commented May 20, 2020

I was using getSubscriptions and the result was an empty array when I used

const itemSkus = Platform.select({
  android: [
    'com.example.coins100'
  ]
});

and it started working when i removed com.example and made it simply coins100.

const itemSkus = Platform.select({
  android: [
    'coins100'
  ]
});

@mifi
Copy link
Member

mifi commented Jul 22, 2020

FWIW downgrading to react-native-iap@3.3 worked for me. See #977 (comment)
Edit: seems downgrading was not what solved it.

@DavideValdo
Copy link
Author

Properly setting up sandbox account seems to have solved the problem

@mifi
Copy link
Member

mifi commented Jul 30, 2020

I got this problem again now that I tried to add some more IAP's, but they were not returned by getProducts. For me what seemed to resolve the issue was to release the app to Google Play Alpha track. See also https://stackoverflow.com/questions/24835180/android-inapp-billing-responselist-is-empty

@stale
Copy link

stale bot commented Oct 31, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@baronha
Copy link

baronha commented Nov 10, 2020

same (android)

@tosebikan
Copy link

same (ios)

@tosebikan
Copy link

works now, user agreements status for paid apps on App Store connect (IOS) has to be active, and it seems to only work on an actual device and not on a simulator.

@ingerable
Copy link

ingerable commented Dec 21, 2020

Does the app has to be released on Play store as alpha to get your products (and wait the end of the review) ? Because to create in app products on the google play console you just have to upload your signed apk to a track. You don't have to release it. Currently my app is being reviewed on an internal track, I have created my in app products on the console but I still got an empty array.

@mifi
Copy link
Member

mifi commented Dec 21, 2020

If i remember correctly yes I had to release it to alpha

@tosebikan
Copy link

yes @ingerable you need to submit a build to TestFlight at least so your in app subscription becomes active & make sure youve finished submitting all the requirements on the agreement section on App Store connect

@tosebikan
Copy link

make sure your purchases status are approved & use an actual device not your simulator.

@ingerable
Copy link

I am using a real device, each of my purchases has the status active. My app is currently being reviewed for closed track release, should I be able to retrieve my products ? As I said, currently I have an empty array as response.

@tosebikan
Copy link

you should get them, after release

@stale
Copy link

stale bot commented Jun 9, 2021

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale label Jun 9, 2021
@andresesfm
Copy link
Collaborator

Duplicate of this: #1231. Closing as stale, feel free to reopen if you have more information

@rajat99938
Copy link

rajat99938 commented Oct 5, 2023

{"_h": 0, "_i": 0, "_j": null, "_k": null} i am getting this in response
any reason can someone help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 android Related to android 🙏 help wanted Extra attention is needed Stale
Projects
None yet
Development

No branches or pull requests

9 participants