Skip to content

[in_app_purchase] Ability to discern error versus cancel in PurchaseStatus.error #83730

@nwparker

Description

@nwparker

Today there is no reasonable way to discern between a "user cancelling the purchase" and "a real error" for in app purchases.

The source code (see excerpt below) states "Some error occurred in the purchase. The purchasing process if aborted".

/// Status for a [PurchaseDetails].
///
/// This is the type for [PurchaseDetails.status].
enum PurchaseStatus {
....
  /// Some error occurred in the purchase. The purchasing process if aborted.
  error,
...
}

There needs to be a way to know if this "error" is simply a user cancelling the purchase or if it's a real error.

The purchaseDetails.error does contain some information, but it seems like figuring out whether or not this was a user cancellation error (at least for iOS) would require parsing the JSON of purchaseDetails.error.details which is extremely unreasonable (and possibly unreliable) and is something that should be handled at the library level.


Proposal
Add a new enum type: PurchaseStatus.cancel so that library to separate these two different occurrences.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: proposalA detailed proposal for a change to Flutterp: in_app_purchasePlugin for in-app purchasepackageflutter/packages repository. See also p: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions