How to use the react-native-purchases.purchasePackage 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 aPackage = this.state.offerings.current.lifetime;
                  try {
                    const purchaseMade = await Purchases.purchasePackage(aPackage, {oldSKU: "old", prorationMode: Purchases.PRORATION_MODE.DEFERRED}, Purchases.PURCHASE_TYPE.SUBS);
                    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.proMonthlyPrice}