I believe I have configured everything correctly, but I am unable to purchase on Android.
I have followed everything shown in this link 'https://community.revenuecat.com/sdks%2D51/why%2Dare%2Dofferings%2Dor%2Dproducts%2Dempty%2D124' but it still doesn't work.
Configure
if (Platform.OS === 'ios') {
try {
Purchases.configure({
apiKey: REVENUE_CAT_IOS_API_KEY,
appUserID: user?.uid,
})
} catch (error) {
console.error('error configuring revenuecat for iOS', error)
await analytics().logEvent('error_configuring_revenuecat_for_ios')
}
} else if (Platform.OS === 'android') {
try {
Purchases.configure({
apiKey: REVENUE_CAT_ANDROID_API_KEY,
appUserID: user?.uid,
})
} catch (error) {
console.error('error configuring revenuecat for Android', error)
await analytics().logEvent('error_configuring_revenuecat_for_android')
}
}
This is where I am trying to fetch the products.
const purchaseStoryToken = async () => {
try {
useSetLoading(true)const products = await Purchases.getProducts(c'dk_story_token'])
console.log('fetched products', products)
const storyTokenProduct = products?.<0]
console.log('storyTokenProduct', storyTokenProduct)await Purchases.purchaseStoreProduct(storyTokenProduct)
} catch (e) {
analytics().logEvent('error_purchasing_product')
console.log('error in purchaseStoryToken', e)
throw e
} finally {
useSetLoading(false)
}
}
LOG fetched products ]
LOG storyTokenProduct undefined
LOG error in purchaseStoryToken bTypeError: Cannot read property 'identifier' of undefined]
I created APK and tested it on a real device as well as on the simulator. The result is the same.
I might have overlooked something, please allow me to know if more information is needed.
Questions:
1- Where should the 'dk_story_token' inside the 'Purchases.getProducts(e'dk_story_token'])' code exactly come from? Where can I retrieve this information, within the Google Play Console or in Revenue Car's dashboard? Where did this string come from?
I'm assuming this string is correct because it works for apple and I've been told that it's the same on the google play side. i'm asking to confirm. Where can I get this?
2- I don't think I have missed a step; I have double-checked multiple times. What should I do?