How to use the react-native-purchases.purchaseProduct function in react-native-purchases

To help you get started, we’ve selected a few react-native-purchases examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RevenueCat / react-native-purchases / example / app / screens / UpsellScreen.js View on Github external
onPress={async () => {
                  const product = this.state.offerings.current.annual.product.identifier;
                  try {
                    const purchaseMade = await Purchases.purchaseProduct(product);
                    checkIfPro(purchaseMade.purchaserInfo, this.props.navigation);
                  } catch (e) {
                    if (!e.userCancelled) {
                      // eslint-disable-next-line no-console
                      console.log(`Error handling ${JSON.stringify(e)}`);
                    } else {
                      // eslint-disable-next-line no-console
                      console.log(`User cancelled ${JSON.stringify(e)}`);
                    }
                  }
                }}
                title={this.state.proAnnualPrice}