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 always return null #124

Closed
companytest1206 opened this issue Apr 13, 2018 · 40 comments
Closed

getProducts always return null #124

companytest1206 opened this issue Apr 13, 2018 · 40 comments
Labels
🤖 android Related to android 🙏 help wanted Extra attention is needed 📱 iOS Related to iOS

Comments

@companytest1206
Copy link

companytest1206 commented Apr 13, 2018

@dooboolab I am receiving null array after calling getProducts method after prepare method.

@hyochan
Copy link
Member

hyochan commented Apr 13, 2018

@companytest1206 This should not happen. Could you please share more information? Such as your codes, your products status, os, devices, and etc. For in-app products configuration, please refer to blog.

@companytest1206
Copy link
Author

companytest1206 commented Apr 13, 2018

Here is my code..

async componentDidMount() {
try {
await RNIap.prepare();
const products = await RNIap.getProducts(itemSkus);
console.log('Products', products);
}
catch (err) {
console.warn(err.code, err.message);
}
this.fetchData();

}

My app status is in alpha mode. Using nexus 6 for debugging.

@hyochan
Copy link
Member

hyochan commented Apr 13, 2018

@companytest1206 Your code seems fine. What about your product configuration in playstore or itunesconnect? Please follow the readme and check everything that I've posted here.

@hyochan hyochan added the 🙏 help wanted Extra attention is needed label Apr 13, 2018
@sanilcgs
Copy link

sanilcgs commented May 2, 2018

I have the same issue.

@axelkennedal
Copy link

I have the same issue but I get an empty array (not a null array, whatever that is supposed to mean). I posted about it here.

@hyochan
Copy link
Member

hyochan commented May 3, 2018

@systemride @sanilcgs Could you please share the platforms you are having trouble with using getProducts method?

@axelkennedal
Copy link

I'm having trouble with this on Android 7.0 (running on an LG G6), developing on MacOS 10.13.4 @dooboolab

@sanilcgs
Copy link

sanilcgs commented May 3, 2018

Created my app using create-react-native-app package. For integrating in-app purchase I have detached my app. After that I integrated react-native-iap into my app. For me the issue is happened in both iOS and android. I am using Android Studio 3.0.1 and Xcode 9.3. @dooboolab

@axelkennedal
Copy link

axelkennedal commented May 3, 2018

According to this README of another library it should be possible to get the available products when running in a debug environment (not an Alpha/Beta release), is that correct? (I'm thinking it should be the same for this library as that probably is dependant on how Google handles the IAP).

@axelkennedal
Copy link

axelkennedal commented May 3, 2018

Another related question; should the SKUs be prefixed with the package name? In other words; is "unlock_premium" or "com.kimer.unlock_premium" correct in my code when the ID I have specified in Google Play Console is "unlock_premium"?

@vadermemo
Copy link

@axelkennedal The SKUS don´t have any format, are totally customizables. In few words: "unlock_premium" or "com.kimer.unlock_premium" are correct.

@axelkennedal
Copy link

I understand that you can name a product ID however you want, but what I asked is what should go in my code if I chose the ID "unlock_premium" in Google Play Console (not whether I'm "allowed" to prefix it both in Google Play Console and in my code). You're saying that choosing the ID "unlock_premium" in Google Play Console should work together with both "unlock_premium" and "com.kimer.unlock_premium", correct? I think this needs to be stated somewhere in the README, because it's confusing.

@axelkennedal
Copy link

axelkennedal commented May 3, 2018

UPDATE

It is now working for me 😄! I tried a couple of things but I'm not sure what was key to getting it to work 🤔 This is anyways what I did:

  1. Reinstalled the package
  2. Changed my import statement from import InAppPurchase from "react-native-iap;" to "import * as InAppPurchase from 'react-native-iap';"
  3. Changed my SKU in the code from "com.kimer.unlock_premium" to "unlock_premium"

@vadermemo
Copy link

@axelkennedal you must use any name, but you must use on Google Play Console> your application > Google Play store> in app products. And the SAME name you must use on source code.

@sanilcgs
Copy link

sanilcgs commented May 4, 2018

@dooboolab When I am trying to execute RNIap.buyProduct('*****') with my productID, I got the error message That item is unavailable. Actually my managed product is in active state. What will be the issue? I can able to list the product details using RNIap.getProducts(itemSkus). Do I need to add the license key into my app??

@hyochan
Copy link
Member

hyochan commented May 4, 2018

@sanilcgs could you tell me which platform you are facing error?

@sanilcgs
Copy link

sanilcgs commented May 4, 2018

@dooboolab I am facing the issue in android platform and developing on MacOS High Sierra (10.13.4)

@hyochan
Copy link
Member

hyochan commented May 4, 2018

@sanilcgs are you using our newer module which is ‘0.3.23’? Also similar issue can be found here. #142

@sanilcgs
Copy link

sanilcgs commented May 4, 2018

@dooboolab Yes I'm using '0.3.23'. My problem is now with RNIap.buyProduct('*'). I got this error 'Error: That item is unavailable.'. Currently I have released my alpha version and published it to google play. I have already created my managed products and all are in active states.

@hyochan
Copy link
Member

hyochan commented May 4, 2018

@sanilcgs I posted some help info for that in above issue. I will paste here again. Please check below.

         Do's

1)Create sign apk for your application.
2)Upload your apk on Google play store.
3)Create product for your application.
4)wait for 6-12 hour for update item's on store.
5)Give Billing permissions in Manifest.xml

           Don't

1)Don't use emulator for testing its does not support Billing Services.
2)Don't use unsigned apk for Billing services.

Read more: http://www.androidhub4you.com/2013/03/how-to-inegrate-in-app-purchase-billing.html#ixzz5DqRctVJp

@sanilcgs
Copy link

sanilcgs commented May 4, 2018

@dooboolab As I already said that my app is not released to production. Now I have released my alpha version only. So can I test this RNIap.buyProduct('****') with my alpha version or do I need to release my production for testing purchase???

@hyochan
Copy link
Member

hyochan commented May 4, 2018

@sanilcgs If you read above thoroughly, you should be aware that you do not need to release apk to production. Just alpha or beta is fine but your apk should be signed as explained. Check above once more and see what you are missing first.

@systemride
Copy link

@dooboolab The do's and don'ts above are helpful. For noobs, this would be really helpful to explain in the documentation that you can only test this on an alpha/beta release and if you test this in a dev build on emulator, it will always return an empty array. I see no mention of that anywhere. I'm happy to add this in a pull request if you'd like?

@hyochan
Copy link
Member

hyochan commented May 12, 2018

@systemride Any PR is appreciated!

@mayankbaiswar-CSE
Copy link

mayankbaiswar-CSE commented May 15, 2018

@axelkennedal did all those things, I'm still getting an empty array on iOS. Any ideas?
btw...I'm still testing on a simulator. Is it necessary to test it on actual iOS device?

@JJMoon
Copy link
Contributor

JJMoon commented May 18, 2018

@axelkennedal getProducts() in iOS works well on simulator. Purchasing actions should be tested on the real device with sandbox apple account.
You might not have finished up App Store product settings perfectly.

@JJMoon JJMoon added 🤖 android Related to android 📱 iOS Related to iOS labels May 18, 2018
@axelkennedal
Copy link

@JJMoon if you read my comments you would have known I'm on Android, not iOS.

@raduflp
Copy link

raduflp commented May 21, 2018

@axelkennedal being passive aggressive with the people who voluntarily spend their precious time trying to help you will not get you a long way.

@JJMoon @dooboolab thank you for the great work

@axelkennedal
Copy link

@raduflp lol what are you talking about? I just pointed out that we are on different platforms

@hyochan
Copy link
Member

hyochan commented May 22, 2018

@raduflp Thank you for your kind response and concern. I don't think @axelkennedal meant to be aggressive. He is just too overwhelmed using react-native-iap. Feel like this issue can be closed so I'll close it. Also, any PR is appreciated that may help new generations.

@NarekChang
Copy link

Try it. Work for me:

"You need additionally add your testing account to another special list of accounts "Gmail accounts with testing access", you can find that on play account setting(not project!). On the page where you can see a list of your projects go to settings, and then on "Account details" page (scroll down, it's almost in the bottom of page) you will find the "Gmail accounts with testing access" list."

Set up application licensing
To set up application licensing, start by adding your list of tester's Gmail addresses in the Play Console.

Go to your Play Console.
Select Settings Settings > Account details.
Under "License Testing," add your testers' Gmail addresses.
At the top of the screen, select Save.

@ShridharCodewave
Copy link

I have integrated the react-native-iap and uploaded my signed apk to beta release on play store and also added one subscription plan. I am trying to get the list of subscription by subscription ID in debug mode which is always returning an empty array. Can I actually test the subscription in debug mode?

@NarekChang
Copy link

@ShridharCodewave you use real device or simulator?

@ShridharCodewave
Copy link

ShridharCodewave commented Sep 19, 2019

@NarekChang I use real device and now somehow I am getting the subscriptions.

@deepanshu01399
Copy link

@NarekChang I use real device and now somehow I am getting the subscriptions.

are you able to get the subscriptions list in your debug build or you need to make a release build to test the subscription list

@arindoneATK
Copy link

getSubscriptions is returning an error right now on android "subscriptionOffers are required for Google Play Subscriptions"

@andresesfm
Copy link
Collaborator

getSubscriptions is returning an error right now on android "subscriptionOffers are required for Google Play Subscriptions"

getSubscriptions does not return that error. And subscriptionOffers IS required to purchase a subscription on Google Play

@rafaelbpa
Copy link

rafaelbpa commented Feb 17, 2023

@NarekChang I use real device and now somehow I am getting the subscriptions.

are you able to get the subscriptions list in your debug build or you need to make a release build to test the subscription list

Did you figure out? I'm baffled by this. Why is so hard to retrieve a simple list of subscriptions? Do we need to publish the app, submitting a signed apk/aab, to TEST/IMPLEMENT our subscriptions? OMG, I almost can't believe it.

btw, how you debug the apk from the play store? Am I confused or what..?

@NarekChang
Copy link

@NarekChang I use real device and now somehow I am getting the subscriptions.

are you able to get the subscriptions list in your debug build or you need to make a release build to test the subscription list

Did you figure out? I'm baffled by this. Why is so hard to retrieve a simple list of subscriptions? Do we need to publish the app, submitting a signed apk/aab, to TEST/IMPLEMENT our subscriptions? OMG, I almost can't believe it.

btw, how you debug the apk from the play store? Am I confused or what..?

I solved this problem, use hooks https://react-native-iap.dooboolab.com/docs/api-reference/hooks

@ZeeshanAhmadKhalil
Copy link

I just restarted the app and the issue got solved.

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 📱 iOS Related to iOS
Projects
None yet
Development

No branches or pull requests

17 participants