React-native-iap: Acknowledge Purchase does not work for Android

Created on 14 May 2020  ·  10Comments  ·  Source: dooboolab/react-native-iap

I try to Acknowledge consumable products but it is not working. I'm getting {"acknowledged":false} response with receipt

I tried two methods according to docs.

v:4.4.8
platform: android
device: real device

try {
          if (Platform.OS === 'ios') {
            RNIap.finishTransactionIOS(purchase.transactionId);
          } else if (Platform.OS === 'android') {
            // If consumable (can be purchased again)
            RNIap.consumePurchaseAndroid(purchase.purchaseToken);
          }
        } catch (ackErr) {
          console.warn('ackErr', ackErr);
        }

and

 try {
          const ackResult = await finishTransaction(purchase, true);
          console.log('ackResult', ackResult);
        } catch (ackErr) {
          console.warn('ackErr', ackErr);
        }

Errors:

Possible Unhandled Promise Rejection (id: 1):
Error: Google is indicating that we have some issue connecting to payment.
Error: Google is indicating that we have some issue connecting to payment.

But I can see purchase in my Google Play console and its accepted.

I'm testing my purchases with Google Test Account, and Android docs says:

https://developer.android.com/google/play/billing/billing_library_overview#test_acknowledging_purchase_with_license_testers

Test acknowledging purchase with license testers
_For purchases made by license testers, the acknowledgement window is shorter. Instead of three days, purchases are refunded and revoked if they are not acknowledged within five minutes._

After 5 minutes my purchases there (actually I'm trying for 3-4 hours and all purchases there). There is no problem on Google Play side but some things are not consistent.

{"acknowledged":false} worries me

🕵️‍♂️ need more investigation 🤖 android

Most helpful comment

I'm experiencing the same issue. Purchase is done, I can see it in Publisher Console, but then it gets refunded.

All 10 comments

Could someone else share anything about this? I've not experienced this yet.

Getting same error

react-native-iap: 4.4.8
react-native: 0.61.5
on real device Nexus 6(7.1.1)

Possible Unhandled Promise Rejection (id: 0):
Error: Google is indicating that we have some issue connecting to payment.

catch block executed most of the time

    purchaseUpdateSubscription = purchaseUpdatedListener(
      async (purchase: InAppPurchase | SubscriptionPurchase) => {
        const receipt = purchase.transactionReceipt;
        if (receipt) {
          try {
            const ackResult = await finishTransaction(purchase);
            console.warn('ackResult', ackResult);
          } catch (ackErr) {
             console.warn('ackErr', ackErr);
          }

subscription is done
because getting purchases response

const purchases = await RNIap.getAvailablePurchases()

I'm experiencing the same issue. Purchase is done, I can see it in Publisher Console, but then it gets refunded.

Has anyone found a solution for this? Have some very frustrated clients...

Has anyone found a solution for this? Have some very frustrated clients...

Have you found the mystery behind this?

Any update on this issue?

+++++

Hi, I'm getting the same problem and also no clue about it

Sentry is reporting:
"ackErr",{"code":"E_DEVELOPER_ERROR","name":"Error","column":1111,"nativeStackAndroid":"[Array]","stack":"index.android.bundle:21:1111\nindex.android.bundle:1441:12207\[email protected]:740:3079\nindex.android.bundle:740:2380\nindex.android.bundle:740:2070\[email protected]:129:205\[email protected]:129:1586\[email protected]:129:484\[email protected]:740:1833\[email protected]:1441:11967\[email protected]:1441:12338\nindex.android.bundle:1440:3666\[email protected]:113:587\nindex.android.bundle:113:1890\[email protected]:113:587\[email protected]:113:1066\nindex.android.bundle:113:1209\[email protected]:129:155\nindex.android.bundle:129:864\[email protected]:134:581\[email protected]:134:947\[email protected]:134:3004\[email protected]:30:2919\nindex.android.bundle:30:1095\[email protected]:30:2611\[email protected]:30:1065\nvalue@[native code]\nvalue@[native code]","sourceURL":"index.android.bundle","userInfo":null,"line":21,"message":"Google is indicating that we have some issue connecting to payment."}]

purchaseUpdateSubscription = purchaseUpdatedListener(async purchase => {
      const receipt = purchase.transactionReceipt;
      if (receipt) {
        const platform = Platform.OS === "ios" ? "APP_STORE" : "PLAY_STORE";
        const { result, error } = await saveSubscriptionToServer(
          purchase,
          platform
        );
        if (!error) {
          console.log("subscription", result);
          this.props.setSubscription(result);
          try {
            if (Platform.OS === "ios") {
              finishTransactionIOS(purchase.transactionId);
            } else if (Platform.OS === "android") {
              acknowledgePurchaseAndroid(purchase.purchaseToken);
            }
            const ackResult = await finishTransaction(purchase);
            console.log(ackResult);
          } catch (ackErr) {
            console.warn("ackErr", ackErr);
            Sentry.captureException(ackErr);
          }
        }
        this.setState({ receipt });
      }
    });

I'm experiencing the same issue. Purchase is done, I can see it in Publisher Console, but then it gets refunded.

Hi, Although the purchase was completed, it was making a refund and I solved it with the following function.

requestPurchase = async () => {
    await RNIap.initConnection();
    try {
      await RNIap.requestPurchase("productCode", true);
       await RNIap.purchaseUpdatedListener(
        purchase => {
          RNIap.consumePurchaseAndroid(purchase.purchaseToken);
          RNIap.acknowledgePurchaseAndroid(purchase.purchaseToken);
        // the purchase has been made
        });
    } catch (err) {
      console.log(err)
       console.warn(err.code, err.message);
    }
  }

Any updates on this? Billing is basically broken for android if you use finishTransaction.

Was this page helpful?
0 / 5 - 0 ratings