How to use the react-native-iap.purchaseErrorListener function in react-native-iap

To help you get started, we’ve selected a few react-native-iap 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 guardian / editions / projects / Mallard / src / hooks / use-subscribe.ts View on Github external
// This is not a requirement on iOS
                const wasAcknowledged = await maybeAcknowledgePurchaseAndroid(
                    purchase,
                )

                if (!wasAcknowledged) {
                    // TODO: what do we do in this case? the purchase has still gone through but will
                    // be cancelled in a few days
                    onWarning('Purchase was not acknowledged')
                }

                setCurrentSubscriptionInfo(info)
                onPurchase(info)
            },
        )
        purchaseErrorSubscription.current = purchaseErrorListener(onError)

        return () => {
            const updateListener = purchaseUpdateSubscription.current
            updateListener && updateListener.remove()
            const errorListener = purchaseErrorSubscription.current
            errorListener && errorListener.remove()
        }
    }, [onPurchase, onWarning, onError])
github esteemapp / esteem-mobile / src / containers / inAppPurchaseContainer.js View on Github external
if (fetchData) {
              fetchData();
            }
          })
          .catch(err =>
            bugsnag.notify(err, report => {
              report.metadata = {
                data,
              };
            }),
          );
      }
    });

    this.purchaseErrorSubscription = purchaseErrorListener(error => {
      if (get(error, 'responseCode') === '3' && Platform.OS === 'android') {
        Alert.alert(
          intl.formatMessage({
            id: 'alert.warning',
          }),
          intl.formatMessage({
            id: 'alert.google_play_version',
          }),
        );
      } else if (get(error, 'responseCode') !== '2') {
        Alert.alert(
          intl.formatMessage({
            id: 'alert.warning',
          }),
          error.debugMessage,
        );