Question

Issue with Subscription Purchase Function after Updating RevenueCat and Google PBL

  • 2 July 2024
  • 1 reply
  • 17 views

Badge +2

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.active["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:

  1. The function does not produce any logs.
  2. The purchase process does not seem to initiate.
  3. No errors or alerts are triggered.
  4. When using Purchases.purchaseProduct instead of Purchases.purchaseStoreProduct, I get an error: "The product is not available for purchase". At least this provides an error response, unlike Purchases.purchaseStoreProduct, which gives no response at all.

Tested on a real device in internal and closed testing to rule out emulator issues.

Questions:

  1. Are there any known issues with RevenueCat version 7.27.4 and Google Play Billing Library 7.0.0 that could cause this behavior?
  2. Do I need to make any additional changes to my project setup after these updates?
  3. 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!


This post has been closed for comments

1 reply

Userlevel 3
Badge +5

Hi! Thank you for reaching out! It looks like you’re passing a string into purchaseStoreProduct when it needs a PurchasesStoreProduct for the parameter. Here is the documentation from GitHub. Can you let us know which SDK version that you updated from?