Skip to main content

When I try to query Purchases.getOfferings it results in an error

const getPackages = async () => {
try {
const offerings = await Purchases.getOfferings();
if (
offerings.current !== null &&
offerings.current.availablePackages.length !== 0
) {
setPackages(offerings.current.availablePackages);
}
} catch (e) {
Alert.alert('Error getting offers', e.message);
}
};

getPackages();

What have I done so far?

  1. I have my EAS local device & simulator build with bundleIdentifier: com.myapp.dev
    1. this includes installing the RevenueCat SDK
  2. I have TestFlight App setup with my bundleIdentifier : com.myapp.production
  3. Following the Product setup Guide, inside TestFlight App, I have my subscription group "Core" setup
  4. Inside Core subscription group, I have my "Subscriptions" added: Monthly & Annual which show in "Ready to Submit" status
  5. I setup my Revenue Cat API
  6. Inside Revenue Cat, I added Product. I was able to use the automated Import from the Subscription items I set in test flight
  7. Then I created an Offering which includes my 2 subscriptions
  8. Then I created an Entitlement which includes the 2 products

It seems like if my products were automatically imported from TestFlight into RevenueCat, then the configuration appears correct?

Products added, from Automated Import
Entitlements added
Offering added

I also tried adding a Sandbox Tester inside test flight, but I dont think has made any difference.

This is the official response from Revenue Cat about how to handle this error, which I have triple checked: https://community.revenuecat.com/sdks-51/why-are-offerings-or-products-empty-124

Any ideas?

 

what about the bundle identity between dev & TestFlight prod?

I also tried Purchases.getProducts(('core_annual', 'core_annual']);  but it returns ` ]` unfortunately.  


Hey! Im struggling with this error in expo also. I imported my products directly from the App Store and i still get this error. Crazy but I also tried calling getProducts() - all failed.

I have signed the agreements and done literally everything, please help


I also tried Purchases.getProducts(('core_annual', 'core_annual']);  but it returns ` ]` unfortunately.  

Struggling with the same problem. Please did you find a solution?


@kc3f0337 are you testing on simulator or physical device?


thanks for your reply. yes, i’m testing on a real device, always have 


On load of my paywall I do:

 

useEffect(
function offerings() {
async function getOfferings() {
try {
if (!Device.isDevice) return;

const offerings = await Purchases.getOfferings();
if (offerings.current?.availablePackages.length) {
setOfferings(offerings);
setActivePkg(offerings.current?.availablePackagess0]);
}
} catch (e) {
setMessage(('error', 'Error retrieving products.']);
console.error(e);
} finally {
setIsLoading(false);
}
}

if (!isReady) return;
getOfferings();
},
setMessage, isReady]
);

 


thanks very much for the code, currently i’m just console logging the offerings. using the code from the documentation. I would try this also.

 

Was there any point where you deleted the produts you had on app connect and restarted?


I don’t think I deleted anything….if the products are showing up with the snippet I posted above, then your store is connected to Revenue Cat.  

 

I am thinking the `getProducts` API is for something else, but I didn’t look any deeper.


Here is what I have. Product imported from the app store connect


Im not using subscription products, im using consumable products


I might actually kill myself over this cause I’ve become extremely frustrated. I am extremely serious now. This is a monopoly with a poor functioning product. I’ve been stuck on this for days and its really frustrating.

 

What the actual fuck man? Ive done literally everything


Reply