dooboolab-community / react-native-iap

In App Purchase module for React Native!
https://react-native-iap.dooboolab.com
MIT License
2.79k stars 638 forks source link

getProducts perfct but requestPurchase show "Google is indicating that we have some issue connecting to payment" #2584

Open iasreact1 opened 11 months ago

iasreact1 commented 11 months ago

I have a project using latest react-native-iap i.e, 12.10.8 it shows incompatible version of kotlin, it says for 1.8.0 and my project is in 1.6.20 and after on searching ...the compatible version for that 1.6.0 kotlin version is 12.10.5 and it perfctly installed and when check inapp data ...products list are coming for all the devices smoothly and now time to requestPurchase and all the devices are successfully purchased, but i have 2 android 13 devices and these two devices shows the pop-up message that says "this version of the application is not configured for billing through google play, please use google help center for more" and my log error shows the purchaseErrorListenrErro :- "{"code": "E_DEVELOPER_ERROR", "debugMessage": "Please ensure the app is signed correctly.", "message": "Google is indicating that we have some issue connecting to payment.", "responseCode": 5}" and request purchase error shows "[Error: Google is indicating that we have some issue connecting to payment.]" i have alreday added all these devices for license testing in google play console & adding billing library aab uploaded to play console in production and if i update my kotlin version in my existing project it will conflict all the libraries and my code is `
useEffect(() => { initilizeIAPConnection(); purchaseUpdateSubscription = RNIap.purchaseUpdatedListener( async purchase => { console.log('purchase', purchase); const receipt = purchase.transactionReceipt; console.log('Reciept', receipt);

            if (receipt) {
                try {
                    if (Platform.OS === 'ios') {
                        // RNIap.finishTransactionIOS(purchase.transactionId);
                        RNIap.finishTransactionIOS({ purchase, isConsumable: false });
                    } else if (Platform.OS === 'android') {
                        // await RNIap.consumeAllItemsAndroid(purchase.purchaseToken);
                        console.log('Got into Android...', purchase.purchaseToken);
                        // await RNIap.acknowledgePurchaseAndroid(purchase.purchaseToken)
                    }
                    // await RNIap.finishTransaction(purchase, true);
                    await RNIap.finishTransaction({ purchase, isConsumable: true});
                } catch (ackErr) {
                    console.log('ackErr INAPP>>>>', ackErr);
                }
            }
        },
    );

    purchaseErrorSubscription = RNIap.purchaseErrorListener(error => {
        console.log('purchaseErrorListener INAPP>>>>', error);
    });

    return () => {
        if (purchaseUpdateSubscription) {
            purchaseUpdateSubscription.remove();

            purchaseUpdateSubscription = null;
        }
        if (purchaseErrorSubscription) {
            purchaseErrorSubscription.remove();

            purchaseErrorSubscription = null;
        }
    };
}, []);

const initilizeIAPConnection = async () => {
    console.log("platform", type);
    await RNIap.initConnection()
        .then(async connection => {
            console.log("initConnection called");
            console.log('IAP result', connection);
            getProduct()
        })
        .catch(err => {
            console.warn(`IAP ERROR ${err.code}`, err.message);
            console.log("ios err", err);
        });

    await RNIap.flushFailedPurchasesCachedAsPendingAndroid()

        .then(async consumed => {
            console.log('consumed all items?', consumed);
        })
        .catch(err => {
            console.warn(
                `flushFailedPurchasesCachedAsPendingAndroid ERROR ${err.code}`,
                err.message,
            );
            console.log('flush err', err);
        });
};

const getProduct = async() => {
    try {
      console.log('itemSkus ', itemSkus);
      const Subs = await RNIap.getProducts({skus: itemSkus});
    //   console.log(' IAP Po', Subs);
      if (Subs.length !== 0) {
        if (Platform.OS === 'android') {
            setProductDetails(Subs)
        } else if (Platform.OS === 'ios') {
          console.log('IAP Subscription', Subs);
        }
      }
    } catch (err) {
      console.log('Error2---', err);
    }
  };

const requestPurchase =async() =>{ try { await RNIap.requestPurchase({skus: [skus]}) .then(async result => { console.log('IAP req product ===>++', result); if (Platform.OS === 'ios') {

          } else if (Platform.OS === 'android') {

        })

        .catch(err => {
          console.log("err2",err);
        });
    } catch (err) {
      console.log("err3",err);
    }
  }

} ` please help ...

iasreact1 commented 11 months ago

@hyochan @andresesfm please help regarding that???

Ggayane commented 2 weeks ago

did you find a solution?