Solved

User who canceled subscription can't restore purchase

  • 21 December 2021
  • 2 replies
  • 139 views

Userlevel 1
Badge +9

We are using Flutter and have an Android user who paid for a monthly subscription Dec 9th and canceled, but their subscription should be active until Jan 9th. They were trying to restore their purchase several times but it seems like restoring just hangs after waiting up to 2 minutes. The success/failure toasts that normally appear don’t seem to be triggering for them. 

Other Android users have been able to restore their purchase successfully.

Are there any known issues for when users have canceled but are in an active subscription state? Pasted our restore purchase code & attached a screenshot of our user’s Google Play subscription screen.

 

Future<bool> restorePurchase(BuildContext context) async {
final PurchasesErrorCode? code = await requestToRestorePurchases();
if (code == null) {
triggerToast(context: context, text: 'Purchase restored!');
triggerHeavyHaptic();
return true;
} else {
triggerToast(
context: context, text: 'Could not restore existing subscription.');
triggerHeavyHaptic();
return false;
}
}


Future<PurchasesErrorCode?> requestToRestorePurchases() async {
logPurchaseAction('purchase restore', {});

try {
final PurchaserInfo restoredInfo = await Purchases.restoreTransactions();
processRestoredPurchaseSubscription(restoredInfo);
return null;
} on PlatformException catch (e, stackTrace) {
final PurchasesErrorCode code = PurchasesErrorHelper.getErrorCode(e);
if (code == PurchasesErrorCode.purchaseCancelledError) {
logPurchaseAction('purchase restore cancel', {});
} else {
Logger.e(
error: e,
stackTrace: stackTrace,
name: 'Purchase',
message: 'Failed to restore purchases for $code',
);
}

return code;
}
}

 

 

icon

Best answer by sharif 3 January 2022, 18:14

View original

2 replies

Userlevel 5
Badge +9

If they’re not seeing the success/failure toast in just a few seconds and the process is taking an unusually long time, this may be an issue on their device (e.g. slow network connection, too many background apps, etc.) It doesn’t seem to be widespread either judging from what you’re describing. Have they tried connecting to a different Wifi network and/or restarting the device? That would be my next troubleshooting step for them.

Userlevel 1
Badge +9

You’re right that it turned out that it works after they restart the app with Wifi on, thanks!

Reply