[expo-in-app-purchases] finishTransactionAsync() does not consume purchased item

Hello,

I went to the bare workflow for expo-in-app-purchases. I use the code from the documentation:

      InAppPurchases.setPurchaseListener(({ responseCode, results, errorCode }) => {
        console.log(results);
        if (responseCode === InAppPurchases.IAPResponseCode.OK) {
          console.log("RESPONSE CODE OK");
          results.forEach(async purchase => {
            if (!purchase.acknowledged) {
              console.log(`Successfully purchased ${purchase.productId}`);
              // Process transaction here and unlock content...

              // Then when you're done
              await InAppPurchases.finishTransactionAsync(purchase, true);
            }
          });
        }
        // Else find out what went wrong
        else if (responseCode === InAppPurchases.IAPResponseCode.USER_CANCELED) {
          console.log('User canceled the transaction');
        } else if (responseCode === InAppPurchases.IAPResponseCode.DEFERRED) {
          console.log('User does not have permissions to buy but requested parental approval (iOS only)');
        } else {
          console.warn(`Something went wrong with the purchase. Received errorCode ${errorCode}`);
        }
      })

InAppPurchases.finishTransactionAsync(purchase, true) is supposed to consume the product but each time I buy again, it piles up with the products purchased earlier.
Here is the output of results after 3 purchases of the same item:

[   {
      "acknowledged":false,
      "orderId":"GPA.3324-8205-8555-10022",
      "packageName":"com.***t",
      "productId":"220credits",
      "purchaseState":1,
      "purchaseTime":1590673171487,
      "purchaseToken":"goiknpliojkfllolbijkiino.AO-J1OwWxXrn-mMhRr17pIBAI69kcVevjn-ekuT1-en0gKQtNZk4XpXCSPMJLXc_RBxp_VAWSRqgn8VoqJZRTVOnIy1lZOWp-Ep4UgVR4Nfu0kl1fCYNsE8RwZ_3mp4cG-cfP7f3pSLz"
   
},
   {
      "acknowledged":false,
      "orderId":"GPA.3359-4349-6316-57677",
      "packageName":"com.***",
      "productId":"220credits",
      "purchaseState":1,
      "purchaseTime":1590673180845,
      "purchaseToken":"flinnafimlibdnijhbplalnm.AO-J1Ox7Q9j0g3BWNLGPfjt0zUKKSLPnImtvk2zUA-XdC7VptmGLFsuTkgoFCyBCWPTqKOcKZdMOfZzXPFF44e88CbHBExgoNDuZzPKoWjTEz0Zzv8NX4o3GbwtVhizO0W4x0D6q8HRb"
   
},
   {
      "acknowledged":false,
      "orderId":"GPA.3323-3164-9373-99628",
      "packageName":"com.***",
      "productId":"220credits",
      "purchaseState":1,
      "purchaseTime":1590673189256,
      "purchaseToken":"ccmlgiokbjbjlglhomchmmnc.AO-J1OyqciKd3ZJQ7FvBoZd_hCtIsUfWNV16jBfgMPw9JH_RJ1n-VXjcAlwsbBpDNn-wpR7OlOlcjL8EVa0HwU47K_Uoy-4kp0It0Ru7JbGvYPphfcS_ljvq97Bl4e_RjmKZyUdkGssg"
   
}
]

If I comment await InAppPurchases.finishTransactionAsync(purchase, true); I get the same behavior but get an errorCode 8 if I click again on the same item. Although I still get aknowledged=false and purchaseState=1.

I don’t understand how this should work and there is nothing more on the internet related to expo-in-app-purchases, I don’t know if I should even keep trying with this.

1 Like

It’s true Expo IAP Don’t work …
I made a try in production juste in case but it’s the same thing.
In theory, I will be refound in 3 days.
I can’t put my app in production because of that. :frowning:

@kashis, @bidetaggle Were you able to solve the issue? Our purchases from Android app have being refunded after 3 days of purchase.

1 Like

Same situation here. Only happening in Android.

I try to find solution but no progress yet.

Is this a bug? or just missing settings?