We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://stackoverflow.com/questions/58410482/exposing-all-revenuecat-purchaseserrorcode-codes-in-flutter?sem=2
Expose error codes as enums or equivalent in Dart so they don't have to be hard-coded.
The proposed solution would be to add something like this
enum PurchasesErrorCode { UnknownError, PurchaseCancelledError, StoreProblemError, PurchaseNotAllowedError, PurchaseInvalidError, ProductNotAvailableForPurchaseError, ProductAlreadyPurchasedError, ReceiptAlreadyInUseError, InvalidReceiptError, MissingReceiptFileError, NetworkError, InvalidCredentialsError, UnexpectedBackendResponseError, ReceiptInUseByOtherSubscriberError, InvalidAppUserIdError, OperationAlreadyInProgressError, UnknownBackendError, InsufficientPermissionsError } try { } on PlatformException catch (e) { PurchasesErrorCode errorCode = PurchasesErrorCode.values[int.parse(e.code)]; switch (errorCode) { case PurchasesErrorCode.UnknownError: case PurchasesErrorCode.PurchaseCancelledError: case PurchasesErrorCode.StoreProblemError: // Add rest of cases } }
The text was updated successfully, but these errors were encountered:
Would be useful!
Sorry, something went wrong.
Fixed on https://github.com/RevenueCat/purchases-flutter/releases/tag/1.0.0
You can do this now:
try { PurchaserInfo purchaserInfo = await Purchases.purchasePackage(package); } on PlatformException catch (e) { var errorCode = PurchasesErrorHelper.getErrorCode(e); if (errorCode == PurchasesErrorCode.purchaseCancelledError) { print("User cancelled"); } else if (errorCode == PurchasesErrorCode.purchaseNotAllowedError) { print("User not allowed to purchase"); } }
No branches or pull requests
https://stackoverflow.com/questions/58410482/exposing-all-revenuecat-purchaseserrorcode-codes-in-flutter?sem=2
Expose error codes as enums or equivalent in Dart so they don't have to be hard-coded.
The proposed solution would be to add something like this
The text was updated successfully, but these errors were encountered: