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
  • 333 replies
  • May 29, 2024

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

1import { Platform } from 'react-native';
2
3//...
4
5export default class App extends React.Component {
6
7 componentDidMount() {
8 Purchases.setLogLevel(Purchases.LOG_LEVEL.DEBUG);
9
10 if (Platform.OS === 'ios') {
11 await Purchases.configure({ apiKey: <public_apple_api_key> });
12 } else if (Platform.OS === 'android') {
13 await Purchases.configure({ apiKey: <public_google_api_key> });
14
15 // OR: if building for Amazon, be sure to follow the installation instructions then:
16 await Purchases.configure({ apiKey: <public_amazon_api_key>, useAmazon: true });
17 }
18
19 }
20}

 


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