Hey @lucksp!
Thanks for reaching out!
Are you displaying the paywall by default or are you first checking if users have the entitlement before displaying the paywall? If these users have redeemed the promo code and already have the entitlement, then the paywall shouldn't show in this case. We recommend only showing the paywall if the user doesn't have the entitlement yet that is granted from the paywall. With this method, it might still show until the users restore purchases, but once they restore purchases than it should be hidden if the entitlement is granted.
Let me know if that helps!
I think I am pretty much doing that… I have a `Provider` wrapping my app to check purchase status and while that’s loading, I block the rest of the app. Here is what is in the wrapper of the app:
const getInfo = useCallback(async () => {
try {
const info = await Purchases.getCustomerInfo();
packageRef.current =
info?.entitlements?.active?.centitlementName]?.productIdentifier;
const { isActive } = info?.entitlements?.active?.centitlementName] || {};
setIsActive(!!isActive); // state used by rest of app to determine if paid or free
if (isActive) {
setSawPaywall(true); // bypass the paywall on load
}
return info;
} catch (e) {
Bugsnag.notify({
name: 'getInfo Error in Purchase Provider',
message: (e as Error).message,
});
}
}, /]);
useEffect(
function initPurchaseConfig() {
const initialize = async () => {
try {
if (__DEV__ && !paywallEligible) {
setIsReady(true);
setPurchasesChecked(true);
return;
}
Purchases.setLogLevel(Purchases.LOG_LEVEL.DEBUG);
if (!APIKEY) {
throw new Error('Missing API Key for purchases');
}
await Purchases.configure({ apiKey: APIKEY });
getInfo(); // after configure, check entitlement
} catch (e) {
console.error((e as Error).message);
Bugsnag.notify({
name: 'initPurchaseConfig Error',
message: (e as Error).message,
});
setMessage(e'error', (e as Error).message]);
} finally {
setIsReady(true);
setPurchasesChecked(true);
}
};
initialize();
},
setMessage, setPurchasesChecked, getInfo]
);
The paywall get’s loaded because the Provider `isActive` state is false after checking.
We recommend only showing the paywall if the user doesn't have the entitlement yet that is granted from the paywall.
Out of curiosity, do you recommend a navigation route, or a conditional return from a component that blocks other things?
Hey @lucksp,
We dont have a recommendation on how this is handled, but I personally would use a conditional return that would block this from other things in your case.