Reputation: 2889
I'm using revenuecat for in-app purchase I want to add "Monthly subscription", So I follow the Docs for configuration. and set up everything as they wrote.
For code part
In App.js
import Purchases from 'react-native-purchases';
export default class App extends React.Component {
componentDidMount() {
...
Purchases.setDebugLogsEnabled(true);
Purchases.setup('apiKey');
}
......
}
here a specific screen here should I return the price, name, time "monthly" and other data (display product)
import React, {Component} from 'react';
import {View, Text} from 'react-native';
import Purchases from 'react-native-purchases';
export default class OneMonthPurchases extends Component {
getOfferings = async () => {
try {
const offerings = await Purchases.getOfferings();
console.log('offerings', offerings); // offerings: {"all": {}}
} catch (error) {
console.log('error when get offerings', error);
}
};
componentDidMount() {
this.getOfferings();
}
render() {
return (
<View>
<Text>One Month Purchases</Text>
</View>
);
}
}
but when I log offers I got offerings: {"all": {}}
So how can I solve it Or I miss something?
Note: I test on simulator
Upvotes: 3
Views: 2730
Reputation: 5169
RevenueCat has a guide on the most common reasons for this error in their Help Center here: https://support.revenuecat.com/hc/en-us/articles/360041793174-Why-are-my-products-offerings-or-available-packages-empty-
The below answer is pulled from that article:
If you're still testing in sandbox, it's most likely a configuration issue that's preventing the products from being retrieved from Apple/Google. Your product identifiers are set in RevenueCat, but the actual products that your users purchase can only be retrieved directly from Apple/Google. Because this communication happens between your app and the stores, RevenueCat doesn't have any visibility into the API requests, however there are some common issues we see.
The product identifier set in RevenueCat matches exactly with the store You're testing on a physical device and not a simulator
The bundle Id [iOS] or package name [Android] are set correctly in your app Products are in the in the 'Ready To Submit' state [iOS]
You've signed your 'Paid Applications Agreement' [iOS]
Your app is published on a closed track and you've added a tester [Android]
If your app is live and everything was working during testing, you should check that:
All products are in the 'Approved' state in App Store Connect [iOS]
Products have been approved for 24hrs+. Due to app store propagation time, it can take 24hrs+ for new products to become available after being approved - this is the same for new apps and adding new products to existing apps.
Upvotes: 3