Rajender Reddy
Rajender Reddy

Reputation: 1

Unable to call back for purchased products ?IAP for React native iOS

''''
requestPurchase = async (sku) => {
        try {
          await RNIap.requestPurchase(sku)
                .then(async (result) => {
                    console.log('IAP req sub', result);
                    if (Platform.OS === 'android') {
                        console.log("android")
                        // can do your API call here to save the purchase details of particular user
                    } else if (Platform.OS === 'ios') {
                        console.log("recipt",result.transactionReceipt)
                        setProductId(result.productId);
                        setReceipt(result.transactionReceipt);
                        // can do your API call here to save the purchase details of particular user
                    }
                   // setBuyIsLoading(false);
                })
                .catch((err) => {
                    //setBuyIsLoading(false);
                    console.warn(`IAP req ERROR %%%%% ${err.code}`, err.message, isModalVisible);
                    setError(err.message);
                });
            console.log("Hiiii......", sku)
        } catch (err) {
            console.log("Error.....", err.message)
            console.warn(err.code, err.message);
        }
    };    
'''

We are requesting to## Heading ## purchase a product and able to purchase the product but not receving any product purchase call back.

Upvotes: 0

Views: 1041

Answers (1)

Sibela Chinareva
Sibela Chinareva

Reputation: 11

Try to remove the async before (result) in your then clause.

Upvotes: 1

Related Questions