androidreact-nativereact-native-iap

I encountered an error while attempting to request subscription function in-app purchases with react-native-IAP library


Based on the below information, it appears that the error is related to a server-side issue with the Google payment service itself rather than an issue with my code or setup.

Error:

{
  "code": "E_DEVELOPER_ERROR",
  "debugMessage": "Server error, please try again.",
  "message": "Google is indicating that we have some issue connecting to payment.",
  "responseCode": 5
}

Package:

"react-native-iap": "^12.10.5",

I have created the product ID from the google play console and passed it in the requestSubscription function after that I am getting this error. if anyone sorted this issue please help or provide me guidance to solve this issue.

Thank you


Solution

  • Please update your subscription code with the provided code, and replace 'skus' with the corresponding SKUs.

    getSubscriptions({ skus: ["testpro123"] })
        .then((value) => {
          requestSubscription({
           subscriptionOffers: [
           {
             sku: "testpro123",
             offerToken:
             value[0]["subscriptionOfferDetails"][0]["offerToken"],
           },
        ],
       })
       .then((value) => console.log(value))
       .catch((error) => console.log(error));
       })
      .catch((err) => console.log(err));
    

    ref:Github issue