How to use the react-native-iap.consumePurchaseAndroid 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 esteemapp / esteem-mobile / src / containers / inAppPurchaseContainer.js View on Github external
.then(() => {
            if (Platform.OS === 'ios') {
              RNIap.finishTransactionIOS(get(purchase, 'transactionId'));
            } else if (Platform.OS === 'android') {
              RNIap.consumePurchaseAndroid(token);
            }
            this.setState({ isProcessing: false });

            if (fetchData) {
              fetchData();
            }
          })
          .catch(err =>
github raindropio / mobile / src / screens / settings / pro / buy / module.js View on Github external
})

            if (res.result)
                RNIap.finishTransactionIOS(purchase.transactionId)
        break

        case 'android':
            res = await Api._post(`${endpoint}/google/inapp`, {
                userId,
                product_id:     purchase.productId,
                token:          purchase.purchaseToken,
                etc:            purchase.dataAndroid
            })

            if (res.result)
                RNIap.consumePurchaseAndroid(purchase.purchaseToken)
        break
    }

    if (res.result)
        return true
    else
        throw new Error('invalid_receipt')
}