Question

Flutter - canMakePayments() never returns on Android

  • 19 August 2021
  • 4 replies
  • 45 views

Badge

To replicate:

Using latest Flutter plugin 3.4.1 and the ‘purchase_tester’ example project

Add an ElevatedButton that calls canMakePayments() 
eg replace the ‘UpsellScreen’ build method with this

@overrideWidget build(BuildContext context) {  return ElevatedButton(    onPressed: () async {      bool _storeAvailable = false;      try {        print("Checking availability");        _storeAvailable = await Purchases.canMakePayments();        print("Store available? $_storeAvailable"); //This line never prints      } on PlatformException catch (e) {        var errorCode = PurchasesErrorHelper.getErrorCode(e);        print("Error was $errorCode");      }    },    child: Text("Check Store Available"),  );}

On Android the call never returns (on iOS it works as expected)

Expected result:
bool returned within a reasonable time (or an exception)

Testing info:
This function was working correctly on vs 3.3.0 of the plugin.

Tested on Android Pixel 4a
Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64)
 


4 replies

Userlevel 3
Badge +7

Hey @Mark Chaplin! 👋

Thanks for reaching out and letting us know about this - the SDK team is looking into this and I’ll follow up as soon as I have more information.

@Mark Chaplin I had the same issue with version 3.4.0, after updating to 3.4.5 canMakePayments work and returning result also for android

Badge

Thanks, I’ll try it. Seems to be mentioned in the 3.4.5 change log too..
https://pub.dev/packages/purchases_flutter/changelog

Can the SDK team confirm?

Userlevel 3
Badge +7

Hey @Mark Chaplin!

Version 3.4.5 of the Flutter SDK resolves this issue- give it a shot and let me know if you’re still having issues!

Reply