I've been using a subscription purchase function in my React Native app with RevenueCat for a while, and it was working perfectly. Recently, I updated RevenueCat to version 7.27.4 and also updated the Google Play Billing Library to version 7.0.0 in my app/build.gradle
. Since these updates, the function no longer produces any logs or performs the purchase action.
My Purchase Function:
import { Alert } from 'react-native';
import Purchases from 'react-native-purchases';
const buySubscriptionMonth = async () => {
console.log("Attempting to buy subscription for 'affirmations_month'");
try {
const { customerInfo, productIdentifier } = await Purchases.purchaseStoreProduct('affirmations_month');
console.log("Purchase completed: ", productIdentifier, customerInfo);
alert("Customer Info after purchase: " + JSON.stringify(customerInfo));
if (customerInfo && customerInfo.entitlements.activee"pro"]) {
dispatch(setSubscriber(true));
navigation.navigate('Record');
setModalVisible(false);
} else {
Alert.alert('You did not subscribe');
}
} catch (e) {
console.error("Error during purchase:", e);
if (!e.userCancelled) {
Alert.alert(e.message || 'An error occurred');
}
}
};
/app/build.gradle
android {
compileSdkVersion 33
defaultConfig {
applicationId "your.package.name"
minSdkVersion 21
targetSdkVersion 33
versionCode 1
versionName "1.0"
missingDimensionStrategy 'store', 'play'
}
// Other configurations...
}
dependencies {
implementation "com.android.billingclient:billing:7.0.0"
// Other dependencies...
}
Issues:
- The function does not produce any logs.
- The purchase process does not seem to initiate.
- No errors or alerts are triggered.
- When using
Purchases.purchaseProduct
instead ofPurchases.purchaseStoreProduct
, I get an error: "The product is not available for purchase". At least this provides an error response, unlikePurchases.purchaseStoreProduct
, which gives no response at all.
Tested on a real device in internal and closed testing to rule out emulator issues.
Questions:
- Are there any known issues with RevenueCat version 7.27.4 and Google Play Billing Library 7.0.0 that could cause this behavior?
- Do I need to make any additional changes to my project setup after these updates?
- Is there a specific way to enable more detailed logging for RevenueCat that could help in diagnosing this issue?
Any guidance or suggestions would be greatly appreciated!