React-native-iap: 'Invalid Product ID Error' but everything is setup correctly

Created on 20 Dec 2019  ·  16Comments  ·  Source: dooboolab/react-native-iap

react-native-iap-4.3.2

react-native-0.59.1

Platforms you faced the error (IOS)

Expected behavior

After clicking on button in app, In-app payment should be triggered

Actual behavior
e_developer_error 'invalid product id'

Tested environment - Real device

Steps to reproduce the behavior
please see my code below. When I click on the button triggered by onPress function, the error pops up
image
image

I have set up certificates, tax and banking agreements, product ids are set up in App store connect..All the steps but it still won't work.

📱 iOS 🙏 help wanted

Most helpful comment

yup. you have to call it every time your app starts

All 16 comments

A weird thing with that error is that everything was working for me, until it suddenly stopped when no code changes were made.
The only thing that solved and got it back to work again was to create a new test user and sign in with its apple id on my test device

@yanush Thanks for responding, unfortunately it has never worked for me to begin with and I've tried all the solutions from other similar threads. I have a sandbox tester account on a real device that I'm using to test but I still get the error 'invalid product id'. I'm also running a release build but no luck.

do you have your test apple id configured also under "iTunes & App Store -> Sandbox Account"?
(In the device settings)

@yanush When I go to setting -> iTunes & App Store, I scrolled all the way down but don't see an option for Sandbox Account. Will it not work even if the apple ID I am signed into is the sandbox account itself?

i'm not sure. just started using this package myself.
which ios version are you using? I'm on 12.4.4 (cause it's an old ipad and it didn't get ios 13)
maybe this thread might help you:
https://stackoverflow.com/questions/57850713/ios-13-how-to-login-in-in-app-purchase-sandbox-account

@yanush Do you have content hosting on? Do you know if that is required for RN's IAP to work in iOS?

I don't have it on and therefore it's not mandatory for RNIap to work

@yanush Sorry for all the questions, I've been stuck on this for the past month. Do you have a server set up for your IAP? That's not needed is it? I don't know what else to look into....

you should be able to validate receipts through client only

@yanush Does your app sell non-consumable, auto-renewable subscription, or non-renewing subscription products by chance?

nope. just consumables for now

@damialajogun can you show me the part of your code where you call RNIap.getProducts()?

I actually removed it from my code because it wasn't being called. I added it in initially to console log and make sure the product IDs are being pulled, which they were, but then removed it as the RNIAP.requestPurchase() isn't using it. Do you think this is wrong?

yup. you have to call it every time your app starts

@yanush you were right, it works now! Thank you soooo much! You have no idea!

Confirmed that RNIap.getProducts needs to be called before RNIAP.requestPurchase().

Was this page helpful?
0 / 5 - 0 ratings