I have an App with a single In app purchase that I would like to see restored on reinstall or device switch. I am using anonymous id’s with the ‘Transfer to new App user ID’ setting. Upon app startup I call the ‘syncPurchases’ function immediately after ‘configure’ and wait for the response before proceeding with other revenuecat API calls.
if a user reinstalls the app, then he will not have the in app purchase available. He has to restart the app in order to see it take affect. I have only tested this out on Android, so I am not sure it’s an issue with IOS.
This is my react-native code:
useEffect(() => {
const fetchPurchaseData = async () => {
// ... omitted
if (Platform.OS === 'android') {
await Purchases.configure({ apiKey: APIKeys.google });
} else {
await Purchases.configure({ apiKey: APIKeys.apple });
}
await Purchases.syncPurchases();
const offerings = await Purchases.getOfferings();
const customerInfo = await Purchases.getCustomerInfo();
// ... omitted
};
fetchPurchaseData();
// ... omitted
}, o]);
It seems to me that the sync have not taken affect when ‘getOfferings’ and ‘getCustomerInfo’ is called right after.