Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

getPurchaseHistory won't work with expo in app purchases

$
0
0

I am currently trying to implement a feature that allows you to restore an old in-app purchase a user may have. I am currently using expo (38.0) along with expo in-app purchases (9.1) and testing on iOS testflight. I have already implemented the purchasing feature and it works just fine, but this feature won't work. Here is the code for it.

restorePurchase = async () => {        this.setState({store: true})        this.setState({isLoading: true})        let found = false        const { responseCode, results } = await InAppPurchases.getPurchaseHistoryAsync()        if (responseCode === InAppPurchases.IAPResponseCode.OK){            results.forEach(result => {                if (result.acknowledged){                    found = true                }            })        }         if (responseCode === InAppPurchases.IAPResponseCode.ERROR) {            this.setState({isLoading: false, store: false})            Alert.alert('Error has occured, please report this bug to the email found in the settings.')        } else if (found) {            const paid = true            const JSONpaid = JSON.stringify(paid)            await AsyncStorage.setItem("Paid", JSONpaid)            this.setState({isLoading: false, store: false})            Alert.alert('Purchase was found and your account was updated! Thank you for your support!')        } else {            this.setState({isLoading: false, store: false})            Alert.alert('No purchase was found, sorry!')        }}

In theory, the code should grab their purchase history, look for an acknowledged purchase, and then update their data accordingly. Once the button is clicked, it ends up stuck on the loading screen indefinitely with no resolve. Since I am using testflight, I unfortunately do not have any way to check the errors, unless someone knows of a way to do so. I don't know how to approach this issue, so please let me know if anyone has any ideas. Thank you in advance!


Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>