Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MuneebQureshi1 opened this issue Jul 17, 2023 · 8 comments

Comments

@MuneebQureshi1
Copy link

MuneebQureshi1 commented Jul 17, 2023

i am getting this error while calling resquestSubscription function in android in IOS its working fine.
please help me if any one sorted this issue.
Thank you

@rafaelbpa
Copy link

Same here. Did you figure out something?

@MuneebQureshi1
Copy link
Author

@rafaelbpa No, You have any idea about that?

@rafaelbpa
Copy link

@MuneebQureshi1 No. The weird part is the subscription apparently is working. But the error still happens. Kinda annoying and scare to test in production.

@MuneebQureshi1
Copy link
Author

@rafaelbpa but i am still getting this error.

@suyogyadavindexnine
Copy link

suyogyadavindexnine commented Aug 18, 2023

@rafaelbpa @MuneebQureshi1 I also faced the same issue, I figured out that I was sending the offerToken manually which was the correct token but still showed this error so what I did was pass the Token that I received from the getSubscriptions function

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));

please make sure you are calling the "initConnection" method before calling all these methods
Ignore dirty coding practice it is just a test code
ref -
https://developer.android.com/google/play/billing/errors#developer_error
https://react-native-iap.dooboolab.com/docs/guides/purchases

@MuneebQureshi1
Copy link
Author

@suyogyadavindexnine Thank you for your help! Your support has been truly valuable.

@kivancagaogluu
Copy link

Hello, can you help me with my codes? I am keep getting
[Error: Google is indicating that we have some issue connecting to payment.]
error and subscriptions keep refunded by Google. Here is my code

import React, { useEffect, useState } from "react";
import {
  acknowledgePurchaseAndroid,
  isIosStorekit2,
  PurchaseError,
  requestSubscription,
  useIAP,
} from "react-native-iap";
import { Button, Text, TouchableHighlight, View } from "react-native";

export const Subscription = () => {

  const { purchase, loading, error } = useIAP();
  const [products, setProducts] = useState([]);

  const {
    connected,
    subscriptions,
    getSubscriptions,
    currentPurchase,
    finishTransaction,
  } = useIAP();

  getSubscriptions({ skus: ["7days", "30days"] });

  const subscribe = async (subscription) => {
    const productId = subscription.productId;
    const offerToken = subscription.subscriptionOfferDetails[0].offerToken;

    try {
      const result = await requestSubscription(
        {
          sku: productId,
          ...(offerToken && {
            subscriptionOffers: [{sku: productId, offerToken}],
          }),
        }
      );

      if (result instanceof PurchaseError) {
         console.log("Error", result);
      }else{

        const finishResult = await finishTransaction({
          purchase: result[0], isConsumable: true, developerPayloadAndroid: result[0].developerPayloadAndroid
        });
        console.log(finishResult);

      }


    }catch (error) {
      console.log(error);
    }

  };

  return (
    <View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
      {subscriptions && subscriptions.map((subscription) => (
        <View>
          <TouchableHighlight onPress={() => {
            subscribe(subscription);
          }}>
            <Text style={{ color: "black", margin: 10 }}>{subscription.name}</Text>
          </TouchableHighlight>
        </View>
      ))}
    </View>
  );

};

@SufianBabri
Copy link
Contributor

In the case of subscription, the finishTransaction function expects you to pass isConsumable: false. Otherwise, on Android, it assumes it's a Product and not a Subscription.

Here is the relevant snippet of the finishTransaction which explains what I've just said:

if (isConsumable) {
  return getAndroidModule().consumeProduct(
    purchase.purchaseToken,
    developerPayloadAndroid,
  );
} else if (
  purchase.userIdAmazon ||
  (!purchase.isAcknowledgedAndroid &&
    purchase.purchaseStateAndroid === PurchaseStateAndroid.PURCHASED)
) {
  return getAndroidModule().acknowledgePurchase(
    purchase.purchaseToken,
    developerPayloadAndroid,
  );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants