react-native-iap icon indicating copy to clipboard operation
react-native-iap copied to clipboard

Android finishTransaction on Downgrade Flow doesn't complete after 12.3.1

Open ahlbet opened this issue 1 year ago • 4 comments

Description

On Android and react-native-iap versions 12.3.1 and greater, during a downgrade flow, the method finishTransaction will not complete. However, on 12.3.0 and previous, this flow will complete successfully and resolve.

Here is the code we're using for finishTransaction:

await RNIap.finishTransaction({
     purchase: purchase,
     isConsumable: false,
});

During testing, I didn't see any relevant logs or error messages; it appears to fail silently or just simply not resolve completely. Let me know if I can run through it again and look for something I may have missed in JS logs or Android Studio logs.

I haven't read through the entirety RNIapModule.kt but this appears to be the change that causes our issue: https://github.com/dooboolab-community/react-native-iap/compare/12.3.0...12.3.1

Expected Behavior

If an Android user downgrades their subscription and completes the purchase within Google Play pop up, finishTransaction should resolve successfully.

Environment:

  • react-native-iap: 12.3.1
  • react-native: 0.71.15
  • Platforms (iOS, Android, emulator, simulator, device): Android device

To Reproduce Steps to reproduce the behavior:

  1. Subscribe to a product
  2. Attempt to downgrade to a cheaper product/subscription
  3. finishTransaction will not complete

ahlbet avatar Feb 15 '24 16:02 ahlbet

me too finishTransaction not called android 12.12.1

dongminlim avatar Feb 21 '24 05:02 dongminlim

For android you should use acknowledgePurchaseAndroid, but I recommend handle on server side, here is the documentation about acknowledge for server side:

  • For product: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.products/acknowledge
  • For subscription: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions/acknowledge

yedi97 avatar Mar 01 '24 08:03 yedi97

@yedi97 what is the function of "acknowledgepurchaseandroid"? To confirm to google, that indeed the user has now "subscribed" for example - as a confirmation?

mikemangas avatar Mar 19 '24 11:03 mikemangas

@yedi97 what is the function of "acknowledgepurchaseandroid"? To confirm to google, that indeed the user has now "subscribed" for example - as a confirmation?

Yes, if not call acknowledgePurchaseAndroid user payment will be refunded after a few days, I remember 3 days

yedi97 avatar Mar 20 '24 02:03 yedi97