Repository: flutter
Issue: [in_app_purchase][Documentation]: How to handle `finishTransaction` method for purchases with errorStatus.
Labels: d: api docs,p: in_app_purchase,package,team-ecosystem,P2,triaged-ecosystem

## Steps to Reproduce

Unknown, it has only happened in a released app

**Expected results:** Should be able to complete in app purchases without errors

**Actual results:** type cast exception


```
type 'PurchaseDetails' is not a subtype of type 'GooglePlayPurchaseDetails' in type cast
_CastError
#0      InAppPurchaseAndroidPlatform.completePurchase (package:in_app_purchase_android/src/in_app_purchase_android_platform.dart:162)
#1      InAppPurchase.completePurchase (package:in_app_purchase/in_app_purchase.dart:187)
#2      AppStoreInitializer._completePurchase (package:app/appstore/appstore_initializer.dart:79)
#3      AppStoreInitializer._purchasesUpdated.<anonymous closure> (package:app/appstore/appstore_initializer.dart:65)
#4      _GrowableList.forEach (dart:core-patch/growable_array.dart:403)
#5      AppStoreInitializer._purchasesUpdated (package:app/appstore/appstore_initializer.dart:63)
#6      _rootRunUnary (dart:async/zone.dart:1436)
#7      _CustomZone.runUnary (dart:async/zone.dart:1335)
#8      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244)
#9      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341)
#10     _DelayedData.perform (dart:async/stream_impl.dart:591)
#11     _StreamImplEvents.handleNext (dart:async/stream_impl.dart:706)
#12     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:663)
#13     _rootRun (dart:async/zone.dart:1420)
#14     _CustomZone.run (dart:async/zone.dart:1328)
#15     _CustomZone.runGuarded (dart:async/zone.dart:1236)
#16     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276)
#17     _rootRun (dart:async/zone.dart:1428)
#18     _CustomZone.run (dart:async/zone.dart:1328)
#19     _CustomZone.runGuarded (dart:async/zone.dart:1236)
#20     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276)
#21     _microtaskLoop (dart:async/schedule_microtask.dart:40)
#22     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49)
```


<details>

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

```
% flutter analyze
Analyzing app...                                     
No issues found! (ran in 7.5s)
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
% flutter doctor -v
[✓] Flutter (Channel stable, 2.5.1, on macOS 11.3.1 20E241 darwin-x64, locale en-CA)
    • Flutter version 2.5.1 at /Users/dgreen/development/flutter_stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ffb2ecea52 (2 weeks ago), 2021-09-17 15:26:33 -0400
    • Engine revision b3af521a05
    • Dart version 2.14.2

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/dgreen/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[!] Android Studio
    • Android Studio at /Users/dgreen/Downloads/Android Studio Preview.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] IntelliJ IDEA Community Edition (version 2021.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.60.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.26.0

[✓] Connected device (2 available)
    • iPhone 12 (mobile) • 73C2DF31-CA40-4FF0-9532-389A33FFE62E • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 94.0.4606.61
```

</details>