I’m using React Native (Expo) and I want to integrate RevenueCat. I am following the guide documentation provided by RevenueCat to set it up:
- https://www.revenuecat.com/docs/getting-started/quickstart
- https://www.revenuecat.com/docs/getting-started/making-purchases
- https://www.revenuecat.com/docs/test-and-launch/sandbox/apple-app-store
I have created a Sandbox account in App Store Connect, but when I test a purchase in iOS Simulator, the Purchases.purchasePackage()
logic does not exit.
try {
console.log("START");
const {customerInfo} = await Purchases.purchasePackage(purchasePackage);
console.log({customerInfo});
if (typeof customerInfo.entitlements.active[ENTITLEMENT_ID] !== "undefined") {
navigation.goBack();
}
} catch (e: any) {
if (e.code === Purchases.PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR) {
Alert.alert("Error purchasing package", e.message);
}
console.log("CATCH");
} finally {
setIsPurchasing(false);
console.log("FINALLY");
}
In other words, "START"
is printed, but {customInfo}
is not. Also, "CATCH"
and "FINALLY"
are not printed.
The purchase popup below keeps opening and not closing, which seems to be the cause. It keeps reopening after completing the purchase:
What can I check? Thank you for your help.