Hi all,
I have implemented RevenueCat with my expo / react native project however I am running into a reoccurring issue where ‘customerInfo’ is not returning from my Purchases call.
I am testing in sandbox and only on IOS (using my iphone on a dev server through expo). Maybe 1 in 20 attempts ‘customerInfo’ is returned from my purchase function. Otherwise the purchase function runs, makes the purchase (I receive all of the typical IOS messages regarding the purchase being successful and can see it listed in my sandbox account on the phone) but the customerInfo object is never returned, and the rest of my code just hangs.
I have tested the purchases by removing the async call - obviously not ideal allowing access to the user before the purchase is made, but for testing everything works. The purchase is made and the user is logged in.. so I am not sure why I am not receiving the customerInfo object.
Hoping for some assistance or an idea if I am handling the config or purchase incorrectly.
Just to recap, I am running the purchase function from revenuecat, waiting for customerInfo to return, then unlocking access to my app for the user. The issue is the purchase is successfully made but customerInfo is never returned, which prevents my app from creating a user on our own server and allowing access.
I have tried all sorts of methods to validate customerInfo and check for any active entitlements, but the issue is that the customerInfo object is rarely ever returned and I cannot find any pattern when it does work.
Thank you!
const APIKeys = {
apple: "appl_xxxxxxxxxx",
};
useEffect(() => {
const setup = async () => {
Purchases.setLogLevel(Purchases.LOG_LEVEL.DEBUG);
Purchases.configure({
apiKey: APIKeys.apple,
appUserID: signUpFormInfo.appUserID
});
try {
const offerings = await Purchases.getOfferings();
if (offerings.current !== null && offerings.current.availablePackages.length !== 0) {
setCurrentOffering(offerings.current.availablePackages);
} else {
alert('An error occurred while getting your available memberships. Please try again.');
}
} catch (e) {
console.log(e);
alert('An error occurred while getting your available membership. Please try again.');
}
};
setup()
}, psignUpFormInfo]);
const purchasedPackage = async (packageId) => {
try { const { customerInfo } = await Purchases.purchasePackage(packageId)
// this is where i run into my issue - customerInfo is not returned so the code hangs here
if (typeof customerInfo.entitlements.active 'pro'] !== "undefined") {
// create user on my server then log them in
} } catch (e) {
if (!e.userCancelled) {
showError(e);
} }