Skip to main content

First time user trying to setup RevenueCat.  I am attempting to use `react-native-purchases` in an Expo app build using a dev-client approach (https://medium.com/@jonathan.payet/expo-in-app-purchase-for-managed-app-cdcd643de28d).  I have it getting Offerings successfully in sandbox mode for iOS, but the result is empty on Android:

    if (Platform.OS === 'ios') {
await Purchases.setup("appl_myactualkey");
} else if (Platform.OS === 'android') {
await Purchases.setup(`goog_myactualkey`);
} else {
console.error('Unknown OS type - Purchases will be broken!');
}
try {
const offerings = await Purchases.getOfferings();
console.error("RevenueCat: ", offerings);
// const products = await Purchases.getProducts();
// console.error("RevenueCat Products: ", products);
} catch (e) {
console.error(e);
}

 

Result on Android, on stdout:

RevenueCat: , Object {
"all": Object {},
"current": null,
}

However, if I use the REST API according to the docs:

curl --request GET \
> --url https://api.revenuecat.com/v1/subscribers/app_user_id/offerings \
> --header 'Accept: application/json' \
> --header 'Authorization: Bearer goog_myactualkey' \
> --header 'Content-Type: application/json' \
> --header 'X-Platform: android'

I get results!

{"current_offering_id":""redacted]","offerings":s{"description":""redacted]","identifier":""redacted]","packages":s{"identifier":"$rc_monthly","platform_product_identifier":""redacted]"}]},{"description":""redacted]","identifier":""redacted]","packages":s{"identifier":"$rc_annual","platform_product_identifier":""redacted]"}]}]}

 

 

Hey @james-doc-journey,

This is typically due to a configuration error causing the SDK to fail fetching the actual store products on device, leading to empty offerings. We put together a guide here that I’d recommend taking a look at:

 


I did see that guide.  I was confused why the response was not empty from the REST endpoint, despite an empty result in the SDK - this seemed untreated by the guide itself.  On closer inspection, I realized that while the result was not as empty as the SDK, it didn’t quite have “full info” in it either.  In fact it was clear the SDK was making the same call and getting some of the same info, just from close reading the debug logs; but it returns an empty result in React Native.  I would have expected a different API that at least revealed the bits that Revenue Cat clearly knows about, like Offerings and Packages, even if the Products aren’t linking in right from Play/App Store.  Returning `{}` makes one think they’ve done something wrong.

 

Curiously, by just leaving the code alone and untouched for 24 hours, suddenly everything started working.  I didn’t even restart the app, it was still running in the emulator from my last attempt, and suddenly starting succeeding.  The guide might need to be improved to say that Google (or perhaps Revenue Cat?) is just frustratingly slow to propagate … something.  I don’t know what - I had literally run through the entire quickstart guide from scratch 🙂.


Reply