Skip to main content
Question

ERROR IN REVENUE CAT SDK SETUP in APP.JS


Forum|alt.badge.img+1


I am trying to integrate Revenue cat in my React native android project but cannot get rid of this error 
[TypeError: Cannot read property 'setupPurchases' of null]
please provide me steps to solve this error as i have gone through all the above steps read articles watched videos implemented example and in every thing this error is common please help on this @React native team , @ Revenue cat community

This post has been closed for comments

2 replies

Forum|alt.badge.img+1

From couple of weeks i am struggling to solve this error  with no luck followed all the steps from documentation , to youtube tutorial but nothing is working kindly help to resolve this error


jeffrey_bunn
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 162 replies
  • May 29, 2024

Hi @communityhelper! setupPurchases is a deprecated method; please use configure instead. Here’s the relevant snippet from our documentation:

import { Platform } from 'react-native';

//...

export default class App extends React.Component {

  componentDidMount() {
    Purchases.setLogLevel(Purchases.LOG_LEVEL.DEBUG);

    if (Platform.OS === 'ios') {
    	await Purchases.configure({ apiKey: <public_apple_api_key> });
    } else if (Platform.OS === 'android') {
    	await Purchases.configure({ apiKey: <public_google_api_key> });

      // OR: if building for Amazon, be sure to follow the installation instructions then:
    	await Purchases.configure({ apiKey: <public_amazon_api_key>, useAmazon: true });
    }

  }
}

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings